Turn Desktop View Off
by Dinesh Thakur Category: Line Drawing Method

A mathematical point (x, y) where x and y are real numbers within an image area, needs to be scan converted to a pixel at location (x’, y’). This may be done by making x’ to be the integer part of x, and y’ to be the integer part of y. In other words, x’ = floor(x) and y’ = floor(y),

 where function floor returns the largest integer that is less than or equal to the arguments. Doing so in essence places the origin of a continuous coordinate system for (x, y) at the lower left corner of the pixel grid in the image space. All the points that satisfy x’? x ? x’ + 1 and y’? y ? y’ + 1 are mapped to pixel (x’, y’). Let us take for example a point P1(1.7, 0.8).


It will be represented by pixel (1, 0). Points P2 (2.2, 1.3) and P3(2.8, 1.9) are both represented by pixel (2, 1). Let us take another approach to align the integer values in the coordinate system for (x, y) with the pixel coordinates. Here we can convert (x, y) by making x’ = floor(x + 0.5) and y’ = floor(y + 0.5). This approach places the origin of the coordinate system for (x, y) at the center of pixel(0,0).


All points that satisfy x’- 0.5 ? x ? x’+0.5 and y’- 0.5 ? y ? y’+0.5 are mapped to pixel (x’, y’). This means that points P1 and P2 are now both represented by pixel (2, 1), whereas point P3 is represented by pixel (3, 2).


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.