22D Graphics PrimitivesGraphics drawing is based on basic geometric structures called graphics primitivesPointsLinesCirclesConic Sections
34.1 Coordinate Reference Frames To describe a picture, first decide upon a convenient Cartesian coordinate system, called the world-coordinate reference frameWCR can be 2D or 3DObjects in pictures described by:positions in world coordinatesColorcoordinate extents = the minimum and maximum x, y, and z values for each object
44.1 Coordinate Reference Frames Screen CoordinatesLocations on a video monitor are referenced in integer screen coordinates, which correspond to the pixel positions in the frame bufferPixel coordinate values give the scan line number (the y value) and the column number (the x value along a scan line)Scan-line algorithms for the graphics primitives use the defining coordinate descriptions to determine the locations of pixels that are to be displayed
54.1 Coordinate Reference Frames Screen CoordinatesFor the present, we assume that each integer screen position references the center of a pixel area
64.1 Coordinate Reference Frames Absolute and Relative Coordinate SpecificationsAbsolute coordinate values: the values specified are the actual positions within the coordinate system in useRelative coordinates: we can specify a coordinate position as an offset from the last position that was referenced (called the current position)
74.6 File Area PrimitivesAnother useful component beside geometric objects is describing an area with filled colorReferred to as fill area or filled areaMost graphics routins require the fill area to specified as polygon- their boundries are described by linear equations.- most surface can be approximated by polygons (called surface tessellation)
84.7 Polygon Fill AreaPolygons: plane figure specified by three or more vertices and connected by edgesHas all vertices within plane- no edge crossingPolygon classification:- Convex: interior angle = or less than 180 degrees- Concave: interior angle greater than 180 degreesImplementations for filling algorithms are complicated for concave polygonsconvexconcave
94.7 Polygon Fill AreaIdentifying concave polygons - extension of some edges will intersect other edges - take a look at the polygon vertex positions relative to the extension line of any edge: some vertices are on one side and some are on the other
104.7 Polygon Fill Area Splitting concave polygons Split concave polygons into a set of convex polygonsUsing edge vectors and edge cross productsUse vertex position relative to edge extension line.
114.7 Polygon Fill Area Splitting concave polygons Assume all polygons in xy planeEk = Vk+1 – VkCalculate cross product of successive edge vectors- if at least z component of one vector is negative, then concave polygon.- no successive vertices are collinear.Split along the line of the first edge vector in the cross product pair.
144.7 Polygon Fill Area Splitting concave polygons Another method is a rotational method
154.7 Polygon Fill AreaSplitting convex polygons into triangle (tessellation) - define any sequence of three consecutive vertices to a triangle. - delete middle vertex from the original list - continue forming triangle - stop when only three vertices are remaining.
164.7 Polygon Fill Area Inside-Outside test Also called odd-even test P Q
174.7 Polygon Fill Area Winding-Number test Count counterclockwise encirclements of pointPQ
184.7 Polygon Fill Area Polygon tables objects in a scene are described as sets of polygon surface facetsObject description includes:- Coordinate information (geometry for the polygon facets)- Surface parameters(color, transparency, and light-reflection properties)Object information are organized in tables.
204.7 Polygon Fill Area Polygon tables Important for check for consistency and completeness:1. each pixel is an end point for at least two edges.2. every edge is part of at least one polygon3. every polygon is closed4. each polygon has at least one shared edge