Upload
corey-short
View
226
Download
8
Embed Size (px)
Citation preview
CS 450: COMPUTER GRAPHICS
PIXEL ADDRESSING AND OBJECT GEOMETRY
SPRING 2015
DR. MICHAEL J. REALE
PIXELS AND COORDINATES
• So far, we’ve been talking about coordinates and locations on the screen using the mathematical definition
• Point = infinitely small location in space
• Pixels, however, actually do take up space
• So, given a coordinate (x,y), how do we interpret it? Which pixel do we fill in?
COORDINATE = LOWER-LEFT CORNER OF PIXEL
• If we treat a coordinate as the lower-left coordinate of a pixel, then a point plotted at (2,3) would look like this:
• The true center of the pixel is, in fact, at (2.5, 3.5)
COORDINATE = LOWER-LEFT CORNER OF PIXEL
• Advantages:
• Allows for precise object representations
• Avoids half-integer pixel boundaries
• Simplifies many scan-conversion algorithms and other raster procedures
PROBLEM: TRUE GEOMETRIC SIZE
• Because pixels have size, it means that we run into some problems when we draw lines and shapes
• For example, if we blindly draw a line from (0,0) to (2,0):
• Our line is actually 3 pixels wide!
• Solution: don’t draw the last pixel only draw pixels “inside” coordinates (0,0) to (2,0)
PROBLEM: TRUE GEOMETRIC SIZE
• We have a similar issue with shapes like squares and rectangles
• Example: rectangle from (0,0) to (4,3)
• Solution: plot pixels “interior” to object boundaries
PROBLEM: OTHER CURVES/SHAPES
• Again, same issue with circles and ellipses (otherwise, radius is too big)
• Solution: shorten by 1 in x and/or y for appropriate octants