The first assignment in Computer Graphics course was making program that draws line of simple equation that includes two points that user write x and y coordinates of them.




So, when user write (0, 0) and (49, 29) the program should draw simple equation y = 29 / 49 x


All points on the equation would be rounded off


First, this is my function that round off the parameter.



When user enter 4 numbers, there is a slope of simple equation


Then by the case if 'm' is bigger than 1 or not, print red dot on every 'y's which are on the equation.



And this is the result.


Red dots are simple equation which contains two points (41, 2) and (1, 25)


This algorithm is used on rasterization a line on pixel coordinate of monitor.

'작업물(Works) > ComputerGraphics' 카테고리의 다른 글

빛 정리(Ambient, Diffuse, Specular, Emissive)  (0) 2022.04.19
[OpenGL]Paint Program  (0) 2016.07.11
[OpenGL]Mouse Callback Function  (0) 2016.07.08
[OpenGL]First OpenGL Project  (0) 2016.07.08

+ Recent posts