Presentation is loading. Please wait.

Presentation is loading. Please wait.

Collision Detection Spring 2004.

Similar presentations


Presentation on theme: "Collision Detection Spring 2004."— Presentation transcript:

1 Collision Detection Spring 2004

2 Content Classification Types of bounding volumes
Discrete, or continuous Types of bounding volumes Bounding volume hierarchy

3 We talked about … Taxonomy Collision detection Continuous, discrete
Collision detection, response Collision detection Particle vs. plane Response and Contact problem Sphere vs. plane (particle vs. offset plane)

4 Point-Plane Collision Detection
x e p v (p: any point on plane) Collision might occur if 1. Close enough and 2. Head toward plane Fall 2014

5 Point-Plane Collision Response 1/2
x- x+ The projection of x- on the plane Fall 2014

6 Point-Plane Collision Response 2/2
x v vT vN frictionless CR: Coefficient of Restitution 0  CR  1 Fall 2014

7 Sphere-Plane Collision
x n p v and e Fall 2014

8 Contact Problem

9 Types of Bounding Volumes (ref)
Sphere Ellipsoid Cylinder OBB (oriented bounding box) AABB (axis-aligned bounding box) K-DOP’s (K-discrete orientation polytopes) Sphere packing Swept sphere volume Spherical shells Convex hull

10 Types of Bounding Volumes

11 Oriented Bounding Boxes
An oriented bounding box is always smaller (maybe equal to) an axis-aligned bounding box.

12 Bounding Volumes Hierarchy
We used simple geometric entities to bound our polytopes. We keep different levels of bounding volumes in a hierarchy tree.

13 Bounding Volume Hierarchies
So far, we have had subdivisions that break the world into cell General Bounding Volume Hierarchies (BVHs) start with a bounding volume for each object Many possibilities: Spheres, AABBs, OBBs, k-dops, …DOP (discrete oriented polytope) More on these later Parents have a bound that bounds their children’s bounds Typically, parent’s bound is of the same type as the children’s Can use fixed or variable number of children per node No notion of cells in this structure

14 BVH Example

15 BVH Construction Top-down: simplest to build
Bound everything Choose a split plane (or more), divide objects into sets Recurse on child sets Can also be built incrementally Insert one bound at a time, growing as required Good for environments where things are created dynamically Can also be built bottom-up Bound individual objects, group them into sets, create parent, recurse What’s the hardest part about this?

16 BVH Operations Some of the operations we’ve looked at so far work with BVHs Frustum culling Collision detection BVHs are good for moving objects Updating the tree is easier than for other methods Incremental construction also helps (don’t need to rebuild the whole tree if something changes) But, BVHs lack some convenient properties For example, not all space is filled, so algorithms that “walk” through cells won’t work

17 Hierarchical bounding volume
AABB OBB Convex polytopes (polyhedra)

18 Separation of Convex Polytopes
H Try to find a hyperplane that separates the two polytopes. A B

19 Separation of Bounding Boxes
l Two boxes do not intersect ↔ there exists a line l such that their projections onto this line do not overlap.

20 The Separating Axis Theorem
The separating axis of two oriented boxes is either perpendicular to one of the faces, or can be obtained as the vector multiplication of two box axes. The interference query between two oriented boxes can be answered by checking 15 axes.

21 Separating Axis (Vertex-Vertex)
u v w L A1 A2 A3 B1 B2 B3 We can show that there exists a vector L such that all three terms have the same sign. Thus:

22 OBB Intersection Exhaustive search of separation plane

23 Temporal Coherence

24 Interference of OBBs Using careful analysis for the various 15 possible axes, it is possible to implement the interference test for two OBBs using about 200 floating-point operations. This method has been implemented and successfully applied to large models.

25 Problem: Fitting OBBs The OBB fitting problem requires finding the orientation of the box that best fits the data Ideally, you want the minimum volume for the box, but that’s hard Instead, turn to an idea from statistics: principal components Point sample the convex hull of the geometry to be bound Find the mean and covariance matrix of the samples The mean will be the center of the box The eigenvectors of the covariance matrix are the principal directions – they are used for the axes of the box The principal directions tend to align along the longest axis, then the next longest that is orthogonal, and then the other orthogonal axis

26 OBB (Oriented Bounding Box)

27 Collision of n Bodies Naïve pairwise comparison: time complexity O(n2)
Sweep and prune Sort: O(nlogn) Sweep: O(n) Output: O(k) Further improvement is possible by considering time coherence (later)

28 Sort/Sweep [one-dimensional]

29 Coherance-based Method
If two intervals i and j overlap at the previous time step, but not at the current time step, one or more exchanges involving either a bi or ei value and a bj or ej value must occur.

30 Three-Dimensional Cases
Can be more complicated Considering AABB: perform 3 one-dimensional tests


Download ppt "Collision Detection Spring 2004."

Similar presentations


Ads by Google