Presentation is loading. Please wait.

Presentation is loading. Please wait.

PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection.

Similar presentations


Presentation on theme: "PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection."— Presentation transcript:

1 PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection

2 Collision Detection – Motivation Essential within varying accuracy bounds and various contexts for a lot of applications

3 Collision Handling Collision Detection Collision Determination Response State Update View Response

4 Collision Detection Between two objects (Narrow phase/Pair processing)‏ Between multiple objects – Broad phase/N-body processing Identify smaller groups of objects that maybe colliding and exclude those that are definitely not colliding – Narrow phase/Pair processing Pair-wise tests for collision within smaller sub-groups

5 Collision Detection Algorithms – Overview Narrow phase algorithms – Ray intersection – Bounding box/Bounding circle – Separating axis theorem – Sweep tests Broad phase algorithms – Bounding volume hierarchy – Spatial Partitioning Grids Trees – Binary space partitioning – Quad trees

6 Ray Intersection PAIRWISE COLLISION DETECTION

7 Ray Intersection Dot Product V 1 -Velocity of ball. P- Plane, r- radius of ball Distance traveled towards plane (direction opposite to normal) in time (t)= t*dot(V 1, Normal)‏ Compute 't' based on the distance to plane. Then, Position of collision will be ball's center + t*V 1 V1V1 P Normal

8 Ray intersection(contd.)‏

9 Did we hit the polygon ?

10 Did we hit the polygon? Not necessarily. We might have hit the plane and not the polygon. (180/PI)* (acos(dot(L1,L2)) +acos( dot(L2, L3)) + acos(dot(L3, L1))) = 180

11 Sphere-Plane P r L' L

12 Sphere-plane L= (N: Normal, D: distance from origin)‏ N.P + D = r N.P + D – r = 0 L' =

13 Sphere-Sphere Sphere with center at C 1 and radius r 1 Sphere with center at C 2 and radius r 2 Collision occurs when |C 1 -C 2 | = r 1 + r 2

14 Space Partitioning BROAD PHASE PARTITIONING

15 Space Partitioning Provide broad phase processing by dividing the space into regions and testing if objects overlap the same region of space Methods using – Grids – Trees

16 Spatial Partitioning – OcTrees & QuadTrees Axis-aligned hierarchical partitioning – OcTree – A volume of 3D world space – QuadTree – An area of 2D world space Tree structure – Parent node has eight/four children and an associated bounding volume/area – Child nodes are created by sub-dividing the volume/area into eight/four smaller equal size sub-cubes/sub-squares by dividing into half along each of the three/two axes – Root node volume/area is generally the smallest axis aligned cube/square that encloses the entire world OcTree Volume sub-division

17 Spatial Partitioning – OcTrees & QuadTrees Static tree or dynamic tree Tree creation – – Top down approach Start with all primitives associated with the root node Recursively split the node volume/area and reassign the primitives to the child nodes Determining which child a primitive belongs to – – Divide the primitives using a X partitioning plane/line then further divide the divisions using the Y partitioning and the using the Z partitioning (in case of OcTrees)‏ – For each child node and each primitive a full AABB overlap test is performed – Expensive Handling overlapping primitives – – Duplicate the primitives in the overlapping volumes/areas – Restrict the placement of primitives to the lowest node that contains the primitive – Used in dynamic trees

18 Spatial Partitioning – OcTrees & QuadTrees Tree creation – – Incremental approach – Suitable for dynamic trees Start with a root node, and add primitives into this node Split the node into child nodes when the number of primitives in the node increase above a certain limit Testing a dynamic tree for collisions – Recursive top-down procedure in which the objects for each non-empty node are checked against all objects in the sub-tree below that node

19 Spatial Partitioning – OcTrees & QuadTrees Loose Trees – To solve the problem of small objects getting stuck high up in the tree due to overlap, the node volumes are expanded by some amount to make them partially overlapping – Assuming spherical objects, the objects are propagated into the child node in which the sphere center is contained – Objects descend deeper into the tree – Another benefit, the depth at which an object is to be inserted can be computed from the size of the object

20 Spatial Partitioning – k-dimensional Trees Generalization of OcTrees and QuadTrees k – Number of dimensions subdivided Instead of simultaneously dividing space in multiple dimensions, the k-d tree divides space along one dimension at a time Advantage – Simpler code for tree operations Other applications – Location of a point in a regions, Nearest neighbors, Locate all points in a given region

21 Binary Space-Partitioning Tree Binary tree structure that recursively partitions space into pairs of subspaces with respect to dividing planes of arbitrary position and orientation. If the space being partitioned is n-dimensional, the dividing planes are (n − 1)-dimensional hyperplanes The two partitions into which the space is divided into are referred to as the positive and negative halfspaces. The positive halfspace lies in front of the dividing hyperplane and the negative halfspace behind it. f

22 Binary Space-Partitioning Tree Types of BSP trees based on partitioning planes – – Auto-partitioning/Polygon aligned – Dividing planes coincide with faces of geometry – Axis aligned i.e. k-d trees – Dividing places are aligned with the XY, YZ or XZ planes – Arbitrary/General – No restrictions of dividing planes Spatial Partitioning Volume/Boundary representation

23 Binary Space-Partitioning Tree Leaf-storing BSP trees – Geometry is stored in leaves of the tree – Internal nodes only store the dividing planes and the references to the child nodes – Collision queries perform tests on all polygons contained in the leaves overlapped by the query object

24 Binary Space-Partitioning Tree Solid Leaf BSP Trees – Represent the solid volume occupied by the input geometry i.e. the dividing planes are selected to separate the solid volume from the exterior of the object – No actual geometry is stored in the nodes – The tree partitions the input volume into a collection of convex polyhedra, which are then represented as the intersection volume of a number of halfspaces – The structure of the tree allows trivial detection of collision i.e. intersection tests directly report whether an object lies in solid or empty space

25 Thank You


Download ppt "PRESENTED BY – GAURANGI TILAK SHASHANK AGARWAL Collision Detection."

Similar presentations


Ads by Google