# Drawing Issues Drawing Coordinate Systems Drawing with Pixels

• Slides: 16
Download presentation

Drawing Issues Drawing Coordinate Systems Drawing with Pixels 1

Part 1: Coordinate Systems We have some choices to make when drawing CS-321 Dr. Mark L. Hornick 2

Which coordinate system should we use? l l Modeling/local coordinates World coordinates Normalized device coordinates Device coordinates 3

Modeling/Local Coordinates l l Convenient for object to be drawn Typical units: meters, feet, etc. Might not be Cartesian (. e. g. polar) floats and doubles are common 10. 0 m (0, 0) CS-321 Dr. Mark L. Hornick 7. 5 m 4

World Coordinates l l l Groups of objects are combined Form a complete image Allows prototype objects l l l Drawn in local coordinates Copied, resized and moved into world coordinates Local/Modeling Coordinates 75 m Units still feet, meters, etc. 100 m World CS-321 Dr. Mark L. Hornick 5

World coordinates CS-321 Dr. Mark L. Hornick 6

World coordinates CS-321 Dr. Mark L. Hornick 7

World coordinates CS-321 Dr. Mark L. Hornick 8

Normalized Device Coordinates l l l Device-independent Horizontal and vertical ranges of 0 to 1 “Independence” layer between world and various devices l l l Screen (windows of various sizes) Printer 1 Viewport (ch 6 in text) l zooming NDC CS-321 Dr. Mark L. Hornick 1 9

Device Coordinates l l Actual pixels to draw Allows for movable drawing windows l l l Usually handled by the window system 1280 Pixel size (pixels/inch) is relevant Typical processing l (xmc, ymc) (xwc, ywc) (xndc, yndc) (xdc, ydc) DC 1 1024 1 CS-321 Dr. Mark L. Hornick 10

How do we go from one coordinate system to another? l Transformation of coordinates l l 2 nd half of course Pay attention in MA-383! CS-321 Dr. Mark L. Hornick 11

Part 2: Drawing with Pixels l Drawing algorithms we’ve looked at: l l l Real pixels have finite size l l Point, line, circle, etc. Assume pixel centers as reference Affects graphic primitive rendering Inter-pixel distances are fixed l Limited precision CS-321 Dr. Mark L. Hornick 12

Pixel Addressing l l Addressing a pixel by its center leads to problems A pixel occupies a finite space l l It is not a true “point” Consider a line from (2, 1) to (5, 1) l l Actual length = 3 Drawn length = 4 longer than theoretical length 4 CS-321 Dr. Mark L. Hornick 3 13

Boundary Addressing l Address pixels by their “boundaries” 3 2 1 0 l 0 1 2 3 4 5 6 7 This “removes” the last pixel CS-321 Dr. Mark L. Hornick 14

Boundary Addressing l We attempt to plot the interior of objects l l draw pixel if center is inside boundary Still not ideal l Pixels are not exactly adjacent –> result too small 6 5 4 3 2 1 0 0 1 2 3 4 5 6 7 CS-321 Dr. Mark L. Hornick 15

Compensating for Pixel Size l Ignore the problem? l May make little difference l l On 12” screen with 1280 pixels, 1 pixel ~. 01” On rectangle 200 x 300 (60000 pixels) § l Dropping 1 pixel > (199 x 299) = 499 pixels (<1% area diff) “Quantization” is most apparent on small elements CS-321 Dr. Mark L. Hornick 16