Write in detail about polygon clipping with example.
Answers
Answered by
0
A convex polygon and a convex clipping area are given. The task is to clip polygon edges using the Sutherland–Hodgman Algorithm. Input is in the form of vertices of the polygon in clockwise order.
Examples:
Input : Polygon : (100,150), (200,250), (300,200)
Clipping Area : (150,150), (150,200), (200,200),
(200,150) i.e. a Square
Output : (150, 162) (150, 200) (200, 200) (200, 174)
sutherland-hodgman-example-11
Example 2
Input : Polygon : (100,150), (200,250), (300,200)
Clipping Area : (100,300), (300,300), (200,100)
Output : (242, 185) (166, 166) (150, 200) (200, 250) (260, 220)
sutherland-hodgman-example-22
Examples:
Input : Polygon : (100,150), (200,250), (300,200)
Clipping Area : (150,150), (150,200), (200,200),
(200,150) i.e. a Square
Output : (150, 162) (150, 200) (200, 200) (200, 174)
sutherland-hodgman-example-11
Example 2
Input : Polygon : (100,150), (200,250), (300,200)
Clipping Area : (100,300), (300,300), (200,100)
Output : (242, 185) (166, 166) (150, 200) (200, 250) (260, 220)
sutherland-hodgman-example-22
Similar questions