1 / 18

Computer Graphics

Computer Graphics. Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep. 2012-2013. Lecturer : Azhee W. MD. E-mail: azhee.muhamad@univsul.net azheewria07@gmail.com. Scan Conversion polygon . Polygon Polygon Classifications

zubeda
Download Presentation

Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep. 2012-2013 Lecturer: Azhee W. MD. E-mail: azhee.muhamad@univsul.net azheewria07@gmail.com

  2. Scan Conversion polygon • Polygon • Polygon Classifications • Identifying Concave Polygons • Splitting Concave Polygons • Inside-Outside Tests • 2 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  3. Polygon • A polyline is a chain of connected line segments. When starting point and terminal point of any polyline is same, i.e. when polyline is closed then it is called polygon. • 3 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  4. Polygon Classifications • interior angle: is an angle inside the polygon boundary • that is formed by two adjacent edges. • convex polygon: interior angles of a polygon are less than or equal to 180° • OrConvex : is a polygon in which the line segment joining any two points within the polygon lies completely inside the polygon • 4 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  5. Polygon Classifications • Concave polygon: the polygon that is not convex. • or Concave: is a polygon in which the line segment joining any two points within the polygon may not lie completely inside the polygon. • 5 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  6. Identifying Concave Polygons • At least one interior angle greater than 180° • 2. The extension of some edges of a concave polygon will • intersect other edges • 3. Some pair of interior points will produce a line segment • that intersects the polygon boundary • 4. Find a cross product for adjacent edges • For a convex polygon all cross products will be of the • same sign (positive or negative) • If some cross products yield a positive value and some a negative value, we have a concave polygon • 6 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  7. Convex or concave? • Convex if no line that contains a side of the polygon contains a point in the interior of the polygon. • Concave or non-convex if a line does contain a side of the polygon containing a point on the interior of the polygon. • 7 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  8. Identifying Concave Polygons(2) • 8 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  9. Splitting Concave Polygons: Cross Product • 9 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  10. example • Q)Use cross product to find normal vector of a polygon with the following vertices: (0.2, -0.4, 0.2), (0.6, 0.7, 0.5), (-0.3, 0.4, -0.3), • (-0.4, -0.3, -0.4) • Answer: • Ek = Vk+1 - Vk • E1 = (a1, a2, a3), E2 = (b1, b2, b3) • E1 x E2 = (a2b3 − a3b2, a3b1 − a1b3, a1b2 − a2b1) • V1 = (0.2, -0.4, 0.2), V2 = (0.6, 0.7, 0.5), V3 = (-0.3, 0.4, -0.3) • E1 = V2 – V1 • = (0.6, 0.7, 0.5) - (0.2, -0.4, 0.2) • = (0.4, 1.1, 0.3) • E2 = V3 – V2 • = (-0.3, 0.4, -0.3) - (0.6, 0.7, 0.5) • = (-0.9, -0.3, -0.8) • E1 x E2 = (1.1*-0.8-0.3*-0.3, 0.3*-0.9-0.4*-0.8, 0.4*-0.3-1.1*-0.9) = (-0.79, 0.05, 0.87) • 10 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  11. Splitting Concave Polygons: Set of Triangles • 11 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  12. Splitting Concave Polygons: Set of Triangles (2) • 12 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  13. Inside-Outside Tests • It is not clear which regions of the xyplane we • should call interior and which regions we should • designate as exterior for a complex polygon with • intersecting regions. • algorithms: • odd-even rule • nonzero winding-number rule • 13 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  14. Inside-Outside Tests (2) • odd-even rule • Draw a reference line from any position to a • distant point outside a closed polyline • The line must not pass through any endpoints • Count the number of line segments crossed along this line • If the number is odd then the • region considered to be • interior • Otherwise, the region is • exterior • 14 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  15. Inside-Outside Tests (2) • nonzero winding-number rule • Counts the number of times the boundary of an object winds • around a particular point in the counterclockwise direction • The count is called the winding number • Initialize winding number to zero • Draw a reference line from any position to a distant point • The line must not pass through any endpoints • Add one to the winding number if the • intersected segment crosses the reference • line from right to left (counterclockwise) • Subtract one from the winding number if the • segment crosses from left to right (clockwise) • If winding number is nonzero, the region is • considered to be interior • Otherwise, the region is exterior • 15 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  16. Example • Q) Use nonzero winding number rule to determine the interior and exterior regions of the following polygon ? • 16 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  17. Example • 17 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

  18. References •  Donald Hearn, M. Pauline Baker, • Computer Graphics with OpenGL, 3rd • edition, Prentice Hall, 2004 •  Chapter 3, 4 • 18 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013

More Related