kinetic data structures and their application in collision detection sean curtis comp 768 oct. 16,...
Post on 21-Dec-2015
216 views
TRANSCRIPT
Kinetic Data Structuresand their Application in
Collision Detection
Sean Curtis
COMP 768
Oct. 16, 2007
Kinetic Data Structures -- COMP 768 2
Motivation
• Convex hull– Points move with time– Recalculate hull at each point– O(n lg n) work at each time step– Instead, define convex hull based on the
points used– Only update hull when necessary
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 3
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 4
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 5
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 6
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 7
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 8
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 9
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 10
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 11
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 12
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 13
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 14
Motivation
Kinetic Data Structures
What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 768 15
Motivation
• Simple solution– Take small time steps and recalculate the
CH for each configuration of points.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 16
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 17
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 18
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 19
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 20
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 21
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 22
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 23
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 24
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 25
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 26
Motivation
• Simple solution– Take small time steps and recalculate the
CH for each configuration of points.– Takes O(n log n) work at each time step.
• An alternative – observe the nodes that form the CH.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 27
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 28
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 29
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 30
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 31
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 32
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 33
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 34
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 35
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 36
Motivation
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 37
Motivation
• Create a data structure that associated the convex hull directly with the vertices that form it.
• Use the trajectories of the nodes to determine when they enter or leave the CH list.
• This is a Kinetic Data Structure.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 38
Concepts
• Moving objects– Continuous motion.– Could maintain some property about the
set by sampling over time and modifying the data structure supporting the property.
– Danger of over- or under-sampling.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 39
Concepts
• Configuration Function– A collection of continuous or discrete
attributes for “mobile” data.– Ex. 1 For a convex hull, it is the ordered list
of points on the hull.– Ex. 2 For the closest pair, it is,simply, the
pair of nodes.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 40
Concepts
• Kinetization– The process of transforming an algorithm
on static data into a data structure appropriate for continuously changing data.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 41
Concepts
• Flight plan– Information about a moving objects current
motion.– The information need not be complete – no
complete a priori knowledge necessary.– Flight plans can update based on
interactions within the environment or with a user.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 42
Concepts
• Global Event Queue– Means through which the object’s motion is
connected to the data structure.– Narrow interface.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 43
Concepts
• Certificates– A set of conditions which prove the
configuration function.– The configuration function can only be
invalidated when certificates change.– The change of the state of certificates are
the events in the queue – certificate failure.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 44
Concepts
• Quality– Ultimately, a KDS is “good” if the cost of
processing a certificate failure is low.– How do we quantify this?
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 45
Concepts
• Responsive– A low worst-case cost for processing a
certificate failure.– This could include updating the proof, the
configuration function, de-scheduling events and scheduling new events.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 46
Concepts
• Efficient– The ratio between total events to external
events is “small”.– “External” events affect the configuration
function.– “Internal” events are events required to fix
KDS internal structures.– External events represent a lower-bound
on the amount of work.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 47
Concepts
• Compact– The maximum number of events in the
queue at any one time is roughly linear in the number of moving objects.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 48
Concepts
• Localized– The maximum number of events in the
queue dependent on a single object is “small”.
– Being “local” implies being “compact”.
Kinetic Data Structures
Kinetic Data Structures -- COMP 768 49
Kinetic Data Structures
Simple ExamplePoints on a line
0 1 2 3 4 5 6 7 8
What is the right-most point?
x
Kinetic Data Structures -- COMP 768 50
Kinetic Data Structures
Simple ExamplePoints on a line
0 1 2 3 4 5 6 7 8
What is the right-most point?
x
Kinetic Data Structures -- COMP 768 51
Kinetic Data Structures
Simple ExamplePoints on a line
What is the right-most point?
0 1 2 3 4 5 6
time
8
6
4
2posi
tion
Kinetic Data Structures -- COMP 768 52
Kinetic Data Structures
Simple ExamplePoints on a line
What is the right-most point?
0 1 2 3 4 5 6
time
8
6
4
2po
sitio
n
Proposed KDS
- Maintain sorted list.
- Every time two points cross we have an event.
- Swap two elements in sorted order.
Kinetic Data Structures -- COMP 768 53
Kinetic Data Structures
Simple ExamplePoints on a line
What is the right-most point?
0 1 2 3 4 5 6
time
8
6
4
2po
sitio
n
Proposed KDS
- Responsive!
- Efficient!
- Not compact!
- Not localized!
Kinetic Data Structures -- COMP 768 54
Kinetic Data Structures
Simple ExamplePoints on a line
Worst case – Not compact and not local
0 1 2 3 4 5 6
time
8
6
4
2posi
tion
Kinetic Data Structures -- COMP 768 55
Kinetic Data Structures
Simple ExamplePoints on a line
• Better solution would be to maintain a max-heap.
• An object would only create an event with its parent (when it passes its parent.)
• Events would cause children to swap with their parent in the binary-tree heap structure.
Kinetic Data Structures -- COMP 768 56
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Apply the principles of KDS to a bounding volume hierarchy.
• We use this to make the cost of updating a BVH cheaper.
Kinetic Data Structures -- COMP 768 57
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• The idea
Kinetic Data Structures -- COMP 768 58
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• The idea
Kinetic Data Structures -- COMP 768 59
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• The idea
(xmin, ymin)
(xmax, ymax)
Kinetic Data Structures -- COMP 768 60
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
xmin
ymax
xmax
ymin
• The idea
Kinetic Data Structures -- COMP 768 61
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• The idea
xmin
ymax
xmax
ymin
Kinetic Data Structures -- COMP 768 62
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• The idea
xmin
ymax
xmax
ymin
Kinetic Data Structures -- COMP 768 63
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Kinetization of BVH– Configuration function – a valid BVH for a
set of moving polygons.– Data structure – hierarchy of BVs where
the extents of each BV by pointers to the extreme vertices.
Kinetic Data Structures -- COMP 768 64
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Events– Leaf-event – Occurs when one vertex in
the polygon overtakes an extreme vertex.
Kinetic Data Structures -- COMP 768 65
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Events– Leaf-event – Occurs when one vertex in
the polygon overtakes an extreme vertex.
Kinetic Data Structures -- COMP 768 66
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Events– Tree-event – Occurs when the extent of an
internal node goes from being defined by a vertex of one child to a vertex of the other child.
Kinetic Data Structures -- COMP 768 67
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Events– Tree-event – Occurs when the extent of an
internal node goes from being defined by a vertex of one child to a vertex of the other child.
Kinetic Data Structures -- COMP 768 68
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Events– Flightplan-update – Occurs when the
flightplan of a vertex changes.
Kinetic Data Structures -- COMP 768 69
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Is this a “good” KDS?– Compact? – Efficient?– Responsive?– Localized?
Kinetic Data Structures -- COMP 768 70
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Compact?– Like any other BVH, for n polygons, the
BVH requires O(n) BVs.– Each BV in the tree has at most six events
(leaf- or tree-events.)– So, queue size is O(n).
Flightplan-change-events are more like impulse functions and would not actually occupy the queue.
Kinetic Data Structures -- COMP 768 71
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Efficient?– The authors claim there are no internal
events.– This would imply perfect efficiency (as the
ratio between total events and external events is 1.)
– However, this is not strictly true. Flightplan-change-events would not necessarily change the configuration function and should be considered “internal”.
Kinetic Data Structures -- COMP 768 72
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive?– This is a function on the action to be taken
for each event.– Furthermore, because insertion and
deletion of events from the queue may take place, queue performance plays a role.
– We’ll assume that all operations on a queue with k elements are O(log k)
Kinetic Data Structures -- COMP 768 73
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive? – Leaf-event– New events must be calculated for all of
the triangles in the leaf. O(1) if number of vertices per polygon is bounded.
– Change in leaf BV needs to be propagated up the tree.
– If the parent tree used the supplanted vertex for its extreme value, new tree events need also be calculated.
Kinetic Data Structures -- COMP 768 74
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive? – Leaf-event– This continues up the tree until a parent is
encountered which uses a different vertex for it’s extreme extent.
– At each level we need to delete and create events. O( log n ).
– We might need to propagate all the way up so total work for Leaf-event is O( log2 n ).
Kinetic Data Structures -- COMP 768 75
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive? – Tree-event– Recalculate all of the tree events for this
node – O(1).– Propagate up the tree like the Leaf-event,
inserting and deleting events at each level.– So, Tree-events are similarly O( log2 n ).
Kinetic Data Structures -- COMP 768 76
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive? – Flighpath-change-event– This is tightly coupled to the locality of the
structure.– The cost of a flightpath change is directly
linked to the number of events that the changing vertex is used.
– Assume that the vertex forms the extent of a BV in every level of the BVH (worst case.)
Kinetic Data Structures -- COMP 768 77
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Responsive? – Flighpath-change-event– Assume that the degree of a vertex is
bounded.– Then a vertex participates in O( log n)
events.– The work done is O( log2 n ).
Kinetic Data Structures -- COMP 768 78
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Compact? – As shown in the responsiveness of the
flightpath-change-event, a single vertex is in O( log n ) events.
Kinetic Data Structures -- COMP 768 79
Kinetic Data Structures
Kinetic Bounding Volume Hierarchy
• Performance? – The proof is insanely complex.– You don’t want to see it.– Really.– Honestly.– But, the basic answer is it’s basically
optimal. (The non-optimality is the difference between n and n log* n.)
Kinetic Data Structures -- COMP 768 80
Kinetic Data Structures
Continuous Collision Detection
• KDS deals with events in continuous time.
• Clearly amenable to continuous collision detection.
• Such an algorithm/KDS exists.
• See references.
Kinetic Data Structures -- COMP 768 81
References
• Basch, Guibas, Hershberger: Data Structures for Mobile Data. In SODA: ACM-SIAM Symposium on Discrete Algorithms. (1997)
• Zachmann, Weller: Kinetic bounding volume hierarchies for deformable objects. In ACM International Conference on Virtual Reality Continuum and Its Applications. (2006)
• Weller, Zachmann: Kinetic Separation Lists for Continuous Collision Detection of Deformable Objects. 3rd Workshop in Virtual Reality Interaction and Physical Simulation. (2006)
Kinetic Data Structures