1
Dr. Scott Schaefer
Intersecting Simple Surfaces
2/66
Types of Surfaces
Infinite Planes Polygons
Convex Ray Shooting Winding Number
Spheres Cylinders
3/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxn
4/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxntvptL )(
5/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxntvptL )(
0)( otvpn
6/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxntvptL )(
)( pontvn
7/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxntvptL )(
vn
pont
)(
8/66
Infinite Planes
Defined by a unit normal n and a point o
0)( oxntvptL )(
vn
ponvp
)(
9/66
Polygons
Intersect infinite plane containing polygon Determine if point is inside polygon
10/66
Polygons
Intersect infinite plane containing polygon Determine if point is inside polygon
How do we know if a point is inside a polygon?
11/66
Point Inside Convex Polygon
12/66
Check if point on same side of all edges
Point Inside Convex Polygon
13/66
Check if point on same side of all edges
Point Inside Convex Polygon
14/66
Check if point on same side of all edges
Point Inside Convex Polygon
15/66
Check if point on same side of all edges
Point Inside Convex Polygon
16/66
Check if point on same side of all edges
Point Inside Convex Polygon
17/66
Check if point on same side of all edges
Point Inside Convex Polygon
18/66
Check if point on same side of all edges
Point Inside Convex Polygon
19/66
Check if point on same side of all edges
Point Inside Convex Polygon
20/66
Check if point on same side of all edges
Point Inside Convex Polygon
21/66
Check if point on same side of all edges
Point Inside Convex Polygon
22/66
Point Inside Convex Polygon
X iP
1iP sign same bemust
)(
)(
1T
i
Ti
T
XP
XP
N
23/66
Point Inside Polygon Test
Given a point, determine
if it lies inside a polygon
or not
24/66
Ray Test
Fire ray from point Count intersections
Odd = inside polygonEven = outside polygon
25/66
Problems With Rays
Fire ray from point Count intersections
Odd = inside polygonEven = outside polygon
ProblemsRay through vertex
26/66
Problems With Rays
Fire ray from point Count intersections
Odd = inside polygonEven = outside polygon
ProblemsRay through vertex
27/66
Problems With Rays
Fire ray from point Count intersections
Odd = inside polygonEven = outside polygon
ProblemsRay through vertexRay parallel to edge
28/66
A Better Way
29/66
A Better Way
30/66
A Better Way
31/66
A Better Way
32/66
A Better Way
33/66
A Better Way
34/66
A Better Way
35/66
A Better Way
36/66
A Better Way
37/66
A Better Way
38/66
A Better Way
39/66
A Better Way
One winding = inside
40/66
A Better Way
41/66
A Better Way
42/66
A Better Way
43/66
A Better Way
44/66
A Better Way
45/66
A Better Way
46/66
A Better Way
47/66
A Better Way
48/66
A Better Way
49/66
A Better Way
50/66
A Better Way
51/66
A Better Way
zero winding = outside
52/66
Requirements
Oriented edges Edges can be processed
in any order
53/66
Computing Winding Number
Given unit normal n =0 For each edge (p1, p2)
If , then inside
1p
2px
xpxp
xpxp
xpxp
xpxpn
21
211
21
21 )()(cos
)()(
))()((
54/66
Advantages
Extends to 3D! Numerically stable Even works on models
with holes (sort of) No ray casting
55/66
Intersecting Spheres
Three possible casesZero intersections: miss the sphereOne intersection: hit tangent to sphereTwo intersections: hit sphere on front and
back side
How do we distinguish these cases?
56/66
Intersecting Spheres
0)()()( 2 rcxcxxF
57/66
Intersecting Spheres
0)()()( 2 rcxcxxF
0)()())(( 2 rctvpctvptLF
58/66
Intersecting Spheres
0)()()( 2 rcxcxxF
0)()())(( 2 rctvpctvptLF
0)()()(2)())(( 22 rcpcptcpvtvvtLF
59/66
Intersecting Spheres
is quadratic in t0))(( tLF
0)()()(2)())(( 22 rcpcptcpvtvvtLF
a b c
60/66
Intersecting Spheres
is quadratic in t
Solve for t using quadratic equation
If , no intersection If , one intersection Otherwise, two intersections
0))(( tLF
0)()()(2)())(( 22 rcpcptcpvtvvtLF
a b c
a
acbbt
2
42
042 acb
042 acb
61/66
Normals of Spheres
0)()()( 2 rcxcxxF
cxxF )(
62/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r
63/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r)(tL
64/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r
1.Perform an orthogonal projection to the plane defined by C, A on the line L(t) and intersect with circle in 2D
)(ˆ tL
65/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r)(tL
2.Substitute t parameters from 2D intersection to 3D line equation
66/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r)(tL
3.Normal of 2D circle is the same normal of cylinder at point of intersection
N
68/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r
PN
69/66
Infinite Cylinders
Defined by a center point C, a unit axis direction A and a radius r
A
C
r
PN
(( ) )P C P C A AN
r