Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep. 2012-2013 Lecturer: Azhee W. MD.

Similar presentations


Presentation on theme: "Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep. 2012-2013 Lecturer: Azhee W. MD."— 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 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 2  Polygon  Polygon Classifications  Identifying Concave Polygons  Splitting Concave Polygons  Inside-Outside Tests

3 University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 3

4 Polygon Classifications University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 4

5 Polygon Classifications University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 5

6 Identifying Concave Polygons University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 6 1.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

7 Convex or concave? University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 7  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.

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

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

10 example University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 10 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)

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

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

13 Inside-Outside Tests University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 13  It is not clear which regions of the xy plane 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

14 Inside-Outside Tests (2) University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 14 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

15 Inside-Outside Tests (2) University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep. 2012-2013 15 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

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

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

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


Download ppt "Computer Graphics Scan Conversion Polygon Faculty of Physical and Basic Education Computer Science Dep. 2012-2013 Lecturer: Azhee W. MD."

Similar presentations


Ads by Google