Kinetic Data Structures and their Application in Collision Detection Sean Curtis COMP 768 Oct. 16, 2007
Kinetic Data Structures -- COMP 7682 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 7683 Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP 7684 Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP 7685 Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 7686 Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 7687 Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 7688 Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP 7689 Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures What happens to the CH when they start moving?
Kinetic Data Structures -- COMP Motivation Simple solution –Take small time steps and recalculate the CH for each configuration of points. Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP 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 Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP Motivation Kinetic Data Structures
Kinetic Data Structures -- COMP 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 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 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 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 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 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 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 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 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 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 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 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 Kinetic Data Structures Simple Example Points on a line What is the right-most point? x
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points on a line What is the right-most point? x
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points on a line What is the right-most point? time position
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points on a line What is the right-most point? time position Proposed KDS - Maintain sorted list. - Every time two points cross we have an event. - Swap two elements in sorted order.
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points on a line What is the right-most point? time position Proposed KDS - Responsive! - Efficient! - Not compact! - Not localized!
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points on a line Worst case – Not compact and not local time position
Kinetic Data Structures -- COMP Kinetic Data Structures Simple Example Points 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 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 Kinetic Data Structures Kinetic Bounding Volume Hierarchy The idea
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy The idea
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy The idea (x min, y min ) (x max, y max )
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy x min y max x max y min The idea
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy The idea x min y max x max y min
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy The idea x min y max x max y min
Kinetic Data Structures -- COMP 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 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 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 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 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 Kinetic Data Structures Kinetic Bounding Volume Hierarchy Events –Flightplan-update – Occurs when the flightplan of a vertex changes.
Kinetic Data Structures -- COMP Kinetic Data Structures Kinetic Bounding Volume Hierarchy Is this a “good” KDS? –Compact? –Efficient? –Responsive? –Localized?
Kinetic Data Structures -- COMP 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 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 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 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 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( log 2 n ).
Kinetic Data Structures -- COMP 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( log 2 n ).
Kinetic Data Structures -- COMP 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 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( log 2 n ).
Kinetic Data Structures -- COMP 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 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 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 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. 3 rd Workshop in Virtual Reality Interaction and Physical Simulation. (2006) Kinetic Data Structures