Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric.

Similar presentations


Presentation on theme: "CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric."— Presentation transcript:

1 CSE 681 Object Intersection

2 CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric form (x,y,z) = P(t)

3 CSE 681 Ray-Object Intersection Implicit forms F(x,y,z) = 0 Ray: P(t) = (x,y,z) = source + t*direction = s + t*v Solve for t: F(P(t)) = 0

4 CSE 681 Ray-Sphere Intersection Implicit form for sphere at origin of radius 1 Ray: Solve: … Use quadratic equation…

5 CSE 681 Ray-Sphere Intersection At 2 + Bt + C = 0 A = |v| 2 B = 2s·v C = |s| 2 - 1 B 2 -4AC no intersection = 0 => just grazes > 0 => two hits

6 CSE 681 Axis-Aligned Cuboid (rectangular solid, rectangular parallelpiped) X = x1 X = x2 Y = y2 Y = y1 Z = z1 Z = z2 P(t) = s + tv t x1 = (x1 - s x )/v x t x2 = (x2 - s x )/v x t y1 = (y1 - s x )/v x … Solve for intersections with planes Planar equations Ray equation

7 CSE 681 Rectangle For each intersection, note whether entering or leaving square side of plane: HOW? Ray is inside after last entering and before first exiting Ray 1 Ray 2

8 CSE 681 Ray-Plane for arbitrary plane ax + by + cz + d = 0 n ·P = -d V1V1 V2V2 V3V3 V4V4 d -n Generalize from axis-aligned planes to any plane:

9 CSE 681 Normal Vector Given ordered sequence of points defining a polygon how do you find a normal vector for the plane? Ordered: e.g., clockwise when viewed from the front of the face Right hand v. left hand space Note: 2 normal vectors to a plane, colinear and one is the negation of the other

10 CSE 681 Normal Vector n = (V 1 - V 2 ) x (V 3 - V 2 ) V1V1 V2V2 V3V3 V4V4 V5V5 V1V1 V2V2 V3V3 V4V4 V5V5 V4V4 V1V1 V2V2 V3V3 V5V5

11 CSE 681 Normal Vector V1V1 V2V2 V3V3 V4V4 V5V5 V1V1 V2V2 V3V3 V4V4 V5V5 V4V4 V1V1 V2V2 V3V3 V5V5 m x =  (y i - y next(i) ) (z i - z next(i) ) m y =  (z i - z next(i) ) (x i - x next(i) ) m z =  (x i - x next(i) ) (y i - y next(i) )

12 CSE 681 Ray-Plane Ax + by + cz + d = 0 P = s + t*v n ·P = -d n· (s+t*v) = -d n·s + t*(n·v) = -d t = -(d + n·s)/(n·v)

13 CSE 681 Ray-Polyhedron Polyhedron - volume bounded by flat faces Each face is defined by a ring of edges Each edge is shared by 2 and only 2 faces Faces can be convex or concave The polyhedron can be convex or concave

14 CSE 681 Polyhedron Classification Polyhedron Convex Polyhedron Concave Polyhedron One or more Concave Polygons Only Convex Polygons Only Convex Polygons One or more Concave Polygons quads triangulated mixed quads triangulated mixed

15 CSE 681 Convex Polyhedron volume bounded by finite number of infinite planes Intersection going from outside to inside Intersection going from inside to outside Computing intersections is similar to cube but using ray-plane intersection and arbitrary number of planes

16 CSE 681 Convex Polyhedron Intersection going from outside to inside Intersection going from inside to outside Record maximum entering intersection - enterMax Record minimum exiting intersection - exitMin If (enterMax < exitMin) polyhedron is intersected

17 CSE 681 Concave Polyhedron Find closest face (if any) intersected by ray Need ray-face (ray-polygon) intersection test

18 CSE 681 Ray-Polyhedron 1. Intersect ray with plane 2. Determine if intersection point is inside of 2D polygon A) Convex polygon B) Concave polygon

19 CSE 681 Ray- Convex Polygon Test to see if point is on ‘inside’ side of each edge E V n n·(VxE) > 0 VxE Dot product of normal Cross product of ordered edge vector from edge source to point of intersection

20 CSE 681 Ray-concave polygon Project to plane of 2 smallest coordinates of normal vector Form semi-infinite ray and count ray-edge intersections Project plane and point of intersection to 2D plane 2D point-inside-a-polygon test

21 CSE 681 2D point inside a polygon test Y Y N N

22 CSE 681 2D point inside a polygon test y

23 CSE 681 Transformed objects Intersect ray with transformed object Use inverse of object transformation to transform ray Intersect transformed ray with untransformed object e.g., Ellipse is transformed sphere Object space World space

24 CSE 681 Transformed objects Object space ray World space ray Transform intersection point and normal back to world space Intersect ray with object in object space

25 CSE 681 Ray-Cylinder r P = s 1 + t 1 *v 1 Q = s 2 + t 2 *v 2 r At closest points

26 CSE 681 Ray-Cylinder

27 CSE 681 Ray-Ellipsoid Geometric construction: all points p such that |p-a| + |p-b| = r d1 d2 |P(t)-a| + | P(t)- b| = r a b

28 CSE 681 Ray-Quadric Algebraic solution v. Numeric solution Ray-Whatever http://en.wikipedia.org/wiki/Quadric


Download ppt "CSE 681 Object Intersection. CSE 681 Object Representation Implicit forms F(x,y,z) = 0 Explicit forms Analytic form x = F(y,z) testing generating Parametric."

Similar presentations


Ads by Google