2 Last weekIntroductionGraphic systemStandard GraphicsTransformation
3 Graphics system overview Hardware components• Video monitors, hardcopy output devices, inputdevices, components for interacting with virtualenvironmentsSoftware components• CAD packages, paint programs, library of graphics routines to generate pictures
4 Graphic Software(1)Two types: special purpose and general programming packages. The first type is for nonprogrammers to generate pictures/charts without worrying about details to produce displays. Easy to use menus are provided. Medical, business, CAD applications• The general programming package has a library of graphics functions that can used in Languages such as C, C++, Java or Fortran. Basic components include those for specifying:• picture components (straight lines, polygons, sphere, cube and other objects)• setting color values• selecting views of the scene• applying transformations such as rotations
5 Graphic Software(2)• Examples of the general graphics programming packages are: GL (graphics library), OpenGL, VRML (virtual-reality modeling language), Java 2D, Java 3D• GKS, 3D GKS, PHIGS, and PHIGS+• ISO and ANSI approved programming packages are: GKS, 3D GKS, PHIGS, and PHIGS+• Others standards are GL and OpenGL• Used in PL are: Open inventor, renderMan,.• MatLab, Mathematics, and Maple provide a set of graphics programming functions
6 Computer Graphics API• OpenGL graphics output primitives are functions used to describe picture components. Output primitives describing geometry of objects are geometric primitives (line, circle, polygon etc).• Explore how primitives are implemented (and improved) via device level algorithm.• Research in computer graphics improved techniques for special applications for faster, realistic, cheaper graphic displays.
8 Introduction(1) a computer-graphics application programming interface(CG API)A general software packagefor graphics applicationssometimesreferred to asProvidea library of functions that we can use withina programming language such as C++ to create pictures
9 Introduction(2) For each type of scene, we describe the structure of the individualObjects and their coordinate locationswithin the scene.the first things for creating apicture is describing thecomponent parts of the scene tobe displayed.Those functions in a graphics package describe thevarious picture componentsare called the graphics output primitives, or simply primitives.
10 Introduction(3) The output primitives describing the geometry of objects as geometric primitives.Like Point positions and straight-line segments asthe simplest geometric primitives.
11 Introduction(4)Additional geometric primitives that can be available in a graphics package.include circles and other conic sections, quadric surfaces,spline curves and surfaces,polygon color areas & functions for char.After specifying the geometry of object within a selected coordinatereference frame, the output primitives are projected to a two dimensionalplane, corresponding to the display area of an output device,and scan converted into integer pixel positions within the frame buffer.
12 Coordinate reference frame(1) To describe a picture,we first decide upon a convenient Cartesian coordinate system, called the world-coordinate reference frame, which could be either two dimensional or three-dimensional.We then describe the objects in our picture by giving their geometric specifications in terms of positions in world coordinates.For instance, we define a straight-line segment with two endpoint positions, and a polygon is specified with a set of positions for its vertices. These coordinate positions are stored in the scene description along with other information about the objects, such as their color and their coordinate extents, which are the minimum and maximum x , y , and z values for each object.
13 Coordinate reference frame(2) A set of coordinate extents is also described as a bounding box for an object.For a two dimensional figure, the coordinate extents are sometimes called an object’s bounding rectangle. Objects are then displayed by passing the scene information to the viewing routines, which identify visible surfaces and ultimately map the objects to positions on the video monitor. The scan-conversion process stores information about the scene, such as color values, at the appropriate locations in the frame buffer, and the objects in the scene are displayed on the output device.
14 Screen Coordinate(1)Locations on a video monitor are referenced in integer screen coordinates, which correspond to the pixel positions in the frame buffer.Pixel coordinate values give the scan line number (the y value) and the column number (the x value along a scan line).Hardware processes, such as screen refreshing, typically address pixel positions with respect to the top-left corner of the screen. Scan lines are then referenced from 0, at the top of the screen, to some integer value, y max , at the bottom of the screen, and pixel positions along each scan line are numbered from 0 to x max , left to right. However, with software commands, we can set up any convenient reference frame for screen positions.For example, we could specify an integer range for screen positions with the coordinate origin at the lower-left of a screen area (Fig. 3-1), or we could use non integer Cartesian values for a picture description.The coordinate values we use to describe the geometry of a scene are then converted by the viewing routines to integer pixel positions within the frame buffer.
15 Screen Coordinate(2) For example, we could specify an integer range for screen positions with the coordinate origin at the lower-left of a screen area, or we could use non integer Cartesian values for a picture description.The coordinate values we use to describe the geometry of a scene are then converted by the viewing routines to integer pixel positions within the frame buffer.
16 Screen Coordinate(3)Scan-line algorithms for the graphics primitives use the defining coordinate descriptions to determine the locations of pixels that are to be displayed.For example, given the endpoint coordinates for a line segment, a display algorithm must calculate the positions for those pixels that lie along the line path between the endpoints.Since a pixel position occupies a finite area of the screen, the finite size of a pixel must be taken into account by the implementation algorithms. For the present, we assume that each integer screen position references the center of a pixel area. (we consider alternative pixel-addressing schemes later.)
17 Absolute and Relative Coordinate Specifications absolute coordinate value means that the values specified are the actual positions within the coordinate system in use.Using relative coordinates. This method is useful for various graphics applications, such as producing drawings with pen plotters, artist’s drawing and painting systems, and graphics packages for publishing and printing applications.Taking this approach, we can specify a coordinate position as an offset from the last position that was referenced (called the current position). An additional function is then used to set a current position before any coordinates for primitive functions are specified. To describe an object, such as a series of connected line segments,we then need to give only a sequence of relative coordinates (offsets), once a starting position has been established. Options can be provided in a graphics system to allow the specification of locations using either relative or absolute coordinates.
18 Point To specify the geometry of a point, we simply give a coordinate position in the world reference frame.Then this coordinate position, along with other geometric descriptions we may have in our scene, is passed to the viewing routines. Unless we specify other attribute values, OpenGL primitives are displayed with a default size and color.The default color for primitives is white and the default point size is equal to the size of one screen pixel.
19 AimExplore how primitives are implemented (and improved) via device level algorithm.Why?Research in computer graphics improved techniques for special applications for faster, realistic, cheaper graphic displays.
20 Line Drawing Algorithm Graphics packages typically provide a function for specifying one or more straight-line segments, where each line segment is defined by two endpoint coordinate positions.
21 Line Drawing Algorithm A straight-line segment in a scene is defined by the coordinate positions for the endpoints of the segment.Example,A computed line position of (10.48, 20.51), for example, is converted to pixel position (10, 21).This rounding of coordinate values to integers causes all but horizontal and vertical lines to be displayed with a stair-step appearance (“the jaggies”)Improvementhigh-resolution systems.adjusting pixel intensities along the line path.
22 Display the line on a Raster Monitor This process digitizes the line into a set of discrete integer positions that, in general, only approximates the actual line path.the graphics system must first project the endpoints to integer screen coordinatesand determine the nearest pixel positions along the line path between the two endpoints.The line color is loaded intothe frame buffer at the corresponding pixel coordinates.Reading from the frame buffer, the video controller plots the screen pixels.This process digitizes the line into a set of discrete integer positions that,in general, only approximates the actual line path
23 Line Equations(1)Determine pixel positions along a straight-line path from the geometric properties of the line. The Cartesian slope-intercept equation for a straight line isY interceptslopeX,Y interval
24 Line Equation(2)Voltage deflection in analog display like vector-scan systemX,Y interval
25 Voltage deflection in analog display like vector-scan system For lines whose slopes have magnitudes | m | > 1, be set proportional to a small vertical deflection voltage with the corresponding horizontal deflection voltage set proportional to , calculated from Eq For lines with m = 1, = and the horizontal and vertical deflections voltages are equal. In each case, a smooth line with slope m isgenerated between the specified end points.X,Y interval