1 / 19

Basic 3D collision detection

Basic 3D collision detection. We want to know if objects have touched Objects are considered to be in continuous motion (vertices are changing) We want to do this stuff FAST!!!. We’ll only do…. Convex polyhedra Objects will be broken into convex polyhedra or we’ll use an enclosing polyhedron

quail-johns
Download Presentation

Basic 3D collision detection

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic 3D collision detection • We want to know if objects have touched • Objects are considered to be in continuous motion (vertices are changing) • We want to do this stuff FAST!!!

  2. We’ll only do… • Convex polyhedra • Objects will be broken into convex polyhedra or we’ll use an enclosing polyhedron • Definition • A line segment joining any two points in the polyhedron is contained in the polyhedron

  3. Two stage process • Bounding boxes • Only test if bounding boxes intersect • Witness test • See if we can stick a plane between them

  4. Bounding box tests • We will not even consider O(N2). • Even for something as easy as bounding boxes

  5. Suppose… • You have a set of line segments • [bi,ei] beginning to end • Bounding boxes in 1D • How could we determine if any overlap? • How fast could I do it?

  6. Overlap test b1 b5 e1 e5 b4 b2 e2 e4 b3 e3 b6 e6 Any ideas now?

  7. Overlap test (1D) O(nlogn + k) algorithm Sort and sweep b1 b5 e1 e5 b4 b2 e2 e4 b3 e3 b6 e6 E  sort(endpoints) O(nlogn) c  0 for each endpoint eE do O(n) if e is a begin endpoint c  c + 1 else c  c - 1 if c > 1 then output overlapping segments O(k)

  8. Overlap test (3D) • We have begin/end combinations for each of 3 dimensions • We build three sorted lists • Each dimension • Sweep 1 dimension • Sweep 2nd dimension only for overlaps • Sweep 3rd dimension only for overlaps • Algorithm remains O(nlogn + k) • Lots of careful “bookkeeping” required. • Sometimes called sweep and prune

  9. Can we do better than O(nlogn)? • Algorithmically we can’t • Lower bound • But…

  10. Coherence • What will make this work is that things do move very far from frame to frame • Coherence • When we update a bounding box, we change the ends • But, usually not be much • Just move it in the list • Expected time: O(n) bingo!!

  11. So, we have two intersecting bounding boxes, what now? • We compare the enclosed polyhedra • What defines intersecting polyhedra?

  12. Intersection definition • Two polyhedra A and B do NOT intersect if there exists a plane P such that A and B are on different sides of P • We call this plane a separating plane • It indicates there’s no intersection • Only works for convex polyhedra

  13. Separating planes • Separating planes will either • Contain a face of one of the polyhedra • - or - • Contain the edge of one polyhedra and are parallel to an edge in the other polyhedra

  14. Determining intersection • For every face and every pair of edges • Is this is a separating plane? • How do we test for space partitioning?

  15. Test • Let p be any point on P and N be normal to P • Dot product of v-p and N will be: • >= 0 for someone on one side • <= 0 for someone on the other side

  16. Contact determination • Can be vertex to plane or edge to edge. We have to again test all pairs

  17. Fast enough to be any use? • Lots of all pairs stuff here. • Can this be fast enough to be any use at all? • How often do we call collision detection?

  18. Witness • A witness is some cached value from a previous computation that we can reuse • Keep track of – • Previous separating plane • Previous collision pair • Why does this make this so fast we’re really impressed?

  19. Use of witnesses • Change from one call to another is very tiny • Separating plane usually does not change • Can it? • We are often searching for the collision time • Colliding edges or face/vertex usually do not change • Can they?

More Related