Download presentation

Presentation is loading. Please wait.

Published byArnold Dowding Modified about 1 year ago

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

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

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

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

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

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

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

10
example University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep 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.3, 0.3* *-0.8, 0.4* *-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

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

13
Inside-Outside Tests University of sulaimanyiah - Faculty of Physical and Basic Education - Computer Dep 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 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 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 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

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

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google