LabPlanet
https://www.labplanet.net/juttelupalstakolme/

algoritmo de bresenham em c codigo code Answer's
https://www.labplanet.net/juttelupalstakolme/viewtopic.php?f=4&t=315958
Page 1 of 1

Author:  roxijan22 [ Fri Jun 24, 2022 1:48 pm ]
Post subject:  algoritmo de bresenham em c codigo code Answer's

bresenham's algorithm is a simple algorithm to draw line segments. It is based on points, lines and the two-dimensional coordinate system. The main goal of this algorithm is to draw a line segment between two points that are on the edge of the canvas.
algoritmo de bresenham em c codigo
Code:
if(dx == 0){
        if(yf > yi){    //linha pra baixo
            while(linha.y != yf)
            {

                linha.y++;             
                putPixel(linha);

            }
        }
        else{           //linha pra cima
            while(linha.y != yf)
            {

                linha.y--;               
                putPixel(linha);

            }
        }

    }
    else if(dy == 0){
        if(xf > xi){    //linha pra direita
            while(linha.x != xf)
            {

                linha.x++;               
                putPixel(linha);

            }
        }
        else{           //linha pra esquerda
            while(linha.x != xf)
            {

                linha.x--;               
                putPixel(linha);

            }
        }
    }

Author:  aljani474 [ Tue Jun 28, 2022 11:09 am ]
Post subject:  Re: algoritmo de bresenham em c codigo code Answer's

roxijan22 wrote:
bresenham's algorithm is a simple algorithm to draw line segments. It is based on points, lines and the two-dimensional coordinate system. The main goal of this algorithm is to draw a line segment between two points that are on the edge of the canvas.
algoritmo de bresenham em c codigo
Code:
if(dx == 0){
        if(yf > yi){    //linha pra baixo
            while(linha.y != yf)
            {

                linha.y++;             
                putPixel(linha);

            }
        }
        else{           //linha pra cima
            while(linha.y != yf)
            {

                linha.y--;               
                putPixel(linha);

            }
        }

    }
    else if(dy == 0){
        if(xf > xi){    //linha pra direita
            while(linha.x != xf)
            {

                linha.x++;               
                putPixel(linha);

            }
        }
        else{           //linha pra esquerda
            while(linha.x != xf)
            {

                linha.x--;               
                putPixel(linha);

            }
        }
    }

pandrama

Page 1 of 1 All times are UTC + 2 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/