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


Boundary-Fill Algorithm

Boundary-fill algorithm is used for region filling when the region is boundary-defined i.e. pixels having colour equal to boundary_col comprise the boundary of region.This algorithm starts with a seed pixel inside the region which is the starting point for the recursive algorithm. The algorithm checks to see if pixel is boundary pixel(defined by boundary_col) or […]

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