*This preview shows
page 1. Sign up
to
view the full content.*

**Unformatted text preview: **what we expect from the
Note:
clipping operation against each edge
clipping Sutherland-Hodgeman Clipping
Sutherland-Hodgman basic routine:
• Go around polygon one vertex at a time
• Current vertex has position p
Current
• Previous vertex had position s, and it has been added to
Previous
and
the output if appropriate
the Sutherland-Hodgeman Clipping
Edge from s to p takes one of four cases:
Edge
takes
(Orange line can be a line or a plane)
inside outside inside outside inside s p
p output s
i output p outside p inside p s
no output i output
p output outside s Sutherland-Hodgeman Clipping
Four cases:
• s inside plane and p inside plane
– Add p to output
Add
– Note: s has already been added
Note:
• s inside plane and p outside plane
– Find intersection point i
Find
– Add i to output
Add
• s outside plane and p outside plane
outside
– Add nothing
• s outside plane and p inside plane
– Find intersection point i
Find
– Add i to output, followed by p
Add Point-to-Plane test
A very general test to determine if a point p is “inside”
very
a plane P, defined by q and n:
defined
(p - q) • n < 0: p inside P (p - q) • n = 0: p on P (p - q) • n > 0: p outside P Remember: p • n = |p| |n| cos (θ)
Remember:
|p|
θ = angle between p and n
angle q q
n p
P q
n p
P p
P n Finding Line-Plane Intersections
Edge intersects plane P where E(t) is on P
Edge
(t)
• q is a point on P
• n is normal to P
(L(t) - q) • n = 0
t = [(q - L0) • n] / [(L1 - L0) • n]
• The intersection point i = L(t) for this value of t
The Line-Plane Intersections
Again, lots of opportunity for optimization
Again,...

View
Full
Document