Translation of a Line

Translation of line comes under the category of geometric transformations.In geometric transformations,the object is transformed relative to a stationary coordinate system or background.In 2D translation,the object is displaced along x and y direction and magnitude of displacement is specified by translation parameters tx and ty. In order to perform a sequence of transformations(translation,scaling,rotation or reflection) […]

Continue reading


Cohen Sutherland Line Clipping Algorithm

Line Clipping Algorithms are used for clipping line with respect to a rectangle called as clipping window. Cohen Sutherland line clipping algorithm checks both the endpoints with four boundaries of rectangle(top,bottom,left and right) to decide whether the point lies inside or outside the four boundaries.This checking is done using a four bit code corresponding to […]

Continue reading


Mid-Point Circle Drawing Algorithm

Mid-Point Circle Drawing algorithm is based on determining subsequent points for drawing a circle.This algorithm also uses the concept of symmetry between octants of a circle. So, we need to use this algorithm on one octant only.Corresponding points in other octants can be plotted using concept of symmetry between octants. #include<stdio.h> #include<conio.h> /*Header file for […]

Continue reading


DDA Line Drawing Algorithm

DDA(Digital DIfferential Analyzer) is a simple line drawing algorithm.It is based on calculating the difference between x and y coordinates of two points and determining which of the two directions need more steps. #include<stdio.h> #include<conio.h> /*Header file for built-in graphics functions such as plot() and initgraph()*/ #include<graphics.h> #include<math.h> int round(float val) { return (int)(val+0.5); } […]

Continue reading


Bresenham’s Line Drawing Algorithm

The Bresenham algorithm is a basic line drawing algorithm. It uses only integer calculations. At every step,we move one unit in x direction and choose among two candidate points in y direction. #include<stdio.h> #include<conio.h> /*Header file for built-in graphics functions such as plot() and initgraph()*/ #include<graphics.h> /* Function To Implement Bresenham’s algorithm */ void line_bresenham(int […]

Continue reading