CSE 681 RayObject Intersections: Planes and Polygons - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

CSE 681 RayObject Intersections: Planes and Polygons

Description:

x. y. z. Ray-Plane Intersection. If P = (x, y, z) then. Given: ax by cz = -d. (a, b, c)T (x, y, z) N P = -d. How shall we intersect a ray with a plane? ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 22
Provided by: naeems
Category:

less

Transcript and Presenter's Notes

Title: CSE 681 RayObject Intersections: Planes and Polygons


1
CSE 681Ray-Object IntersectionsPlanes and
Polygons
2
Mathematical Toolbox
  • Objects are represented by mathematical
    descriptions
  • Implicit form
  • F (x, y, z) 0
  • Explicit form
  • Analytic x F (y, z)
  • Parametric x Px(t)
  • y Py(t)
  • z Pz(t)

Testing
Generating
3
Ray-Object Intersection
  • Implicit Form F(x, y, z) 0
  • Ray P(t) (x, y, z)
  • source t Direction
  • R t D
  • Intersection F(P(t)) 0

4
Ray-Sphere Intersection Recap
  • Solve at2 bt c 0, where
  • Discriminant
  • Solutions

5
Ray-Sphere Test
  • b2 4ac lt 0 Þ No intersection
  • b2 4ac gt 0 Þ Two solutions (enter and exit)
  • b2 4ac 0 Þ One solution (ray grazes sphere)

6
Ray-Plane Intersection
  • Infinite Plane
  • Contains at least three points (not collinear)
  • A line drawn through any two points in it lies
    wholly in the plane
  • Plane Equation
  • ax by cz d 0, where a, b, c, d are
    constants

7
Plane Normal
  • N (a, b, c)T
  • d is the distance to the plane

d
N
y
x
z
8
Ray-Plane Intersection
  • If P (x, y, z) then
  • Given ax by cz -d
  • Þ (a, b, c)T (x, y, z)
  • Þ N P -d
  • How shall we intersect a ray with a plane?

9
Ray-Plane Intersection
V2
V1
  • Let P(t) R t D
  • Solve for t
  • N P -d
  • Þ N (R t D) -d
  • Þ N R t (N D) -d
  • Þ t -(d N R)/(N D)

D
R
V4
V3
What can we say about this equation?
10
Ray-Plane Intersection
V2
V1
  • Let P(t) R t D
  • Solve for t
  • N P -d
  • Þ N (R t D) -d
  • Þ N R t (N D) -d
  • Þ t -(d N R)/(N D)
  • N D 0 ray parallel to the plane
  • N D gt 0 ray points away from the plane

D
R
V4
V3
11
Side Note On Plane Handedness
  • N (V3 - V2) x (V1 - V2)
  • Front face vs back face depends on
  • Left-hand vs right-handedness
  • Vertex order (clockwise vs counter-clockwise)

V2
V1
Take left-handedness
V3
V5
V4
12
Ray-Polygon IntersectionConcavity and
Collinearity
  • Watch for special cases
  • V1, V2, and V3 are collinear
  • Angle gt 180o

13
Ray-Polygon Intersection
  • Perform the ray-plane intersection
  • Test if intersection is in the polygon
  • Solve on the 2D plane
  • How do we do test this?

R
D
14
Polygon Projection
  • Project the plane to an axial plane
  • Project to the two smallest coords of the normal

15
Point Inside/Outside Test
  • Ray intersection test
  • Cast a ray in any direction What direction?
  • Axis-aligned is easy
  • Count the number of intersection
  • If an odd number, point is inside else outside

16
Point Inside/Outside Test
  • Take this polygon
  • Do you for see any problems?
  • How do we count ray-vertex intersections?

17
Special Case Vertices
  • How should we count this?
  • Just count vertices? No odd number of vertices

18
Special Case Vertices
N
N
Y
N
Y
Y
Y
Y
Y
  • If we encounter a vertex, just count the bottom
    one on an edge

19
Perform Check
  • Check
  • ( ( (y lt y2) (y gt y1) ) ( (y lt y1) (y
    gt y2)))
  • All Cases

y1
y2
y2
y1
y
20
Special Case Vertices
N
N
Y
N
Y
Y
Y
Y
Y
  • Try the check in this example

21
Winding Number Test
  • Compute the sum of the angles created by point p
    and all the polygon edges
  • How do we compute the angles?

1
1
2
5
2
5
p
p
3
4
3
4
Inside ??i 3600
Outside ??i 0
Write a Comment
User Comments (0)
About PowerShow.com