Drawing Issues Drawing Coordinate Systems Drawing with Pixels CS-321 11/28/2018 Drawing Issues Drawing Coordinate Systems Drawing with Pixels Dr. Mark L. Hornick
Part 1: Coordinate Systems We have some choices to make when drawing CS-321 Dr. Mark L. Hornick
Which coordinate system should we use? CS-321 11/28/2018 Which coordinate system should we use? Modeling/local coordinates World coordinates Normalized device coordinates Device coordinates Dr. Mark L. Hornick
Modeling/Local Coordinates Convenient for object to be drawn Typical units: meters, feet, etc. Might not be Cartesian (.e.g. polar) floats and doubles are common 10.0m (0,0) 7.5m CS-321 Dr. Mark L. Hornick
World Coordinates Groups of objects are combined Form a complete image Allows prototype objects Drawn in local coordinates Copied, resized and moved into world coordinates Units still feet, meters, etc. Local/Modeling Coordinates 75m 100m World CS-321 Dr. Mark L. Hornick
World coordinates CS-321 Dr. Mark L. Hornick
World coordinates CS-321 Dr. Mark L. Hornick
World coordinates CS-321 Dr. Mark L. Hornick
Normalized Device Coordinates Device-independent Horizontal and vertical ranges of 0 to 1 “Independence” layer between world and various devices Screen (windows of various sizes) Printer Viewport (ch 6 in text) zooming 1 NDC CS-321 Dr. Mark L. Hornick
Device Coordinates DC Actual pixels to draw Allows for movable drawing windows Usually handled by the window system Pixel size (pixels/inch) is relevant Typical processing (xmc,ymc)(xwc,ywc) (xndc,yndc) (xdc,ydc) 1280 1 DC 1024 CS-321 Dr. Mark L. Hornick
How do we go from one coordinate system to another? Transformation of coordinates 2nd half of course Pay attention in MA-383! CS-321 Dr. Mark L. Hornick
Part 2: Drawing with Pixels CS-321 11/28/2018 Part 2: Drawing with Pixels Drawing algorithms we’ve looked at: Point, line, circle, etc. Assume pixel centers as reference Real pixels have finite size Affects graphic primitive rendering Inter-pixel distances are fixed Limited precision CS-321 Dr. Mark L. Hornick Dr. Mark L. Hornick
Pixel Addressing Addressing a pixel by its center leads to problems A pixel occupies a finite space It is not a true “point” Consider a line from (2,1) to (5,1) Actual length = 3 Drawn length = 4 longer than theoretical length 4 CS-321 Dr. Mark L. Hornick 3
Boundary Addressing Address pixels by their “boundaries” 0 1 2 3 4 5 6 7 3 2 1 This “removes” the last pixel CS-321 Dr. Mark L. Hornick
Boundary Addressing We attempt to plot the interior of objects draw pixel if center is inside boundary Still not ideal Pixels are not exactly adjacent –> result too small 6543 2 1 0 1 2 3 4 5 6 7 CS-321 Dr. Mark L. Hornick
Compensating for Pixel Size CS-321 11/28/2018 Compensating for Pixel Size Ignore the problem? May make little difference On 12” screen with 1280 pixels, 1 pixel ~.01” On rectangle 200x300 (60000 pixels) Dropping 1 pixel > (199x299) = 499 pixels (<1% area diff) “Quantization” is most apparent on small elements CS-321 Dr. Mark L. Hornick Dr. Mark L. Hornick