Sutherland-Hodgman Area Clipping Algorithm
A technique for clipping areas developed by Sutherland &
Hodgman
Put simply the polygon is clipped by comparing it against
each boundary in turn
Original Area Clip Left Clip Right Clip Top Clip Bottom
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Left
Clipper
Right
Clipper
Bottom
Clipper
Top Clipper
At each step, a new sequence of
output vertices is generated and
passed to the next window
boundary clipper.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Sutherland-Hodgman Polygon Clipping
There are four possible cases when
processing vertices in sequence around the
perimeter of a polygon.
As each pair of adjacent polygon vertices
is passed to a next window boundary clipper,
we make the following tests:
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
1. If the first vertex is outside the window
boundary and the second vertex is inside
Then , both the intersection point of the polygon
edge with the window boundary and the
second vertex are added to the output vertex
list.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
2. If both input vertices are inside the
window boundary.
Then, only the second vertex is added to
the output vertex list.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
3. If the first vertex is inside the window
boundary and the second vertex is outside.
Then, only the edge intersection with the window
boundary is added to the output vertex list.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
4. If both input vertices are outside the
window boundary.
Then, nothing is added to the output vertex
list.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Sutherland-Hodgman Polygon Clipping (Example)
We illustrate this algorithm by processing the area
in figure against the left window boundary.
Vertices 1 and 2 are outside of the
boundary.
Vertex 3, which is inside, 1' and vertex
3 are saved.
Vertex 4 and 5 are inside, and they
also saved.
Vertex 6 is outside, 5' is saved.
Using the five saved points, we would
repeat the process for the next
window boundary.
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
To clip an area against an individual boundary:
• Consider each vertex in turn against the
boundary
• Vertices inside the boundary are saved for
clipping against the next boundary
• Vertices outside the boundary are clipped
• If we proceed from a point inside the
boundary to one outside, the intersection of
the line with the boundary is saved
• If we cross from the outside to the inside
intersection point and the vertex are saved
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru
Sutherland-Hodgman Example
Each example shows the
point being processed
(P) and the previous
point (S)
Saved points define area
clipped to the boundary
in question
S
P
Save Point P
S
P
Save Point I
I
P
S
No Points Saved
S
P
Save Points I & P
I
Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti
College(Autonomous) Bengaluru

Sutherland Hodgman Polygon Clipping Technique.pptx

  • 1.
    Sutherland-Hodgman Area ClippingAlgorithm A technique for clipping areas developed by Sutherland & Hodgman Put simply the polygon is clipped by comparing it against each boundary in turn Original Area Clip Left Clip Right Clip Top Clip Bottom Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 2.
    Left Clipper Right Clipper Bottom Clipper Top Clipper At eachstep, a new sequence of output vertices is generated and passed to the next window boundary clipper. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 3.
    Sutherland-Hodgman Polygon Clipping Thereare four possible cases when processing vertices in sequence around the perimeter of a polygon. As each pair of adjacent polygon vertices is passed to a next window boundary clipper, we make the following tests: Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 4.
    1. If thefirst vertex is outside the window boundary and the second vertex is inside Then , both the intersection point of the polygon edge with the window boundary and the second vertex are added to the output vertex list. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 5.
    2. If bothinput vertices are inside the window boundary. Then, only the second vertex is added to the output vertex list. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 6.
    3. If thefirst vertex is inside the window boundary and the second vertex is outside. Then, only the edge intersection with the window boundary is added to the output vertex list. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 7.
    4. If bothinput vertices are outside the window boundary. Then, nothing is added to the output vertex list. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 8.
    Prof. Jeo JoyA, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 9.
    Sutherland-Hodgman Polygon Clipping(Example) We illustrate this algorithm by processing the area in figure against the left window boundary. Vertices 1 and 2 are outside of the boundary. Vertex 3, which is inside, 1' and vertex 3 are saved. Vertex 4 and 5 are inside, and they also saved. Vertex 6 is outside, 5' is saved. Using the five saved points, we would repeat the process for the next window boundary. Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 10.
    To clip anarea against an individual boundary: • Consider each vertex in turn against the boundary • Vertices inside the boundary are saved for clipping against the next boundary • Vertices outside the boundary are clipped • If we proceed from a point inside the boundary to one outside, the intersection of the line with the boundary is saved • If we cross from the outside to the inside intersection point and the vertex are saved Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru
  • 11.
    Sutherland-Hodgman Example Each exampleshows the point being processed (P) and the previous point (S) Saved points define area clipped to the boundary in question S P Save Point P S P Save Point I I P S No Points Saved S P Save Points I & P I Prof. Jeo Joy A, Dept. of Computer Science UG, Kristu jayanti College(Autonomous) Bengaluru