• Like
Polygon clipping
Upcoming SlideShare
Loading in...5
×

Polygon clipping

  • 1,936 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,936
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
66
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Polygon ClippingCollection of connected lines is considered asPolygon. A polygon clipper takes as input thevertices of a polygon and returns one(or more)polygons. A closed Polygon when clipped Cthen we may get one or more open c d polygon or Dlines. a A b B
  • 2. When we want clipping of a solid polygonarea(closed polygon), then after clipping theresulting polygon should be closed. It requiresthat lines ab & cd be added to make it closedpolygon. Hence it is difficult to find out whichpieces of sections should be joined to makethe clipped polygon closed.
  • 3. A polygon is called convex if the line joining any two interior points of the polygon lies completely inside the polygon. A non- convex polygon is said to be concave. B B A A
  • 4. Another problem occurs when clipping aclosed polygon into several distinct smallerpolygons as shown: Clipping Window Concave Polygon
  • 5. By convention, a polygon with vertices p1..pnis said to be positively oriented if it producesa anticlockwise direction. And if producesclockwise it will be negative oriented. C D D C L R E L R E B B A A
  • 6. SUTHERLAND-HODGMAN ALGORITHM Each edge of the polygon must be testedagainst each edge of the clip rectangle; newedges must be added, and existing edges mustbe discarded, retained, or divided. Multiplepolygons may result from clipping a singlepolygon. We need an organized way to dealwith all these cases.
  • 7. Steps of Sutherland-Hodgmans polygonclipping algorithm Polygons can be clipped against each edge of the window one at a time.
  • 8.  Vertices which are kept after clipping against one window edge are saved for clipping against the remaining edges. Note that the number of vertices usually changes and will often increases. The original polygon and the clip rectangle.
  • 9. After clipped by theright clip boundary.After clipped by the right and bottomclip boundaries.
  • 10. After clipped by theright, bottom, andleft clip boundaries.After clipped byall fourboundaries.
  • 11. Four Cases of polygon clipping against oneEdge:The clip boundary determines a visible andInvisible region. The edges from vertex can beone of four types: Case 1 : Wholly inside visible region - save endpoint Case 2 : Exit visible region - save the intersection
  • 12.  Case 3 : Wholly outside visible region - save nothing Case 4 : Enter visible region - save intersection and endpoint V1 V2 V1 V1’ V2 Out  in in  in Save V1’,V2 Save V2
  • 13. V2 V1V2 V1’ V1 in  out out  out Save V1’ Save none