Collision handling: detection and response

Similar documents
CPSC / Sonny Chan - University of Calgary. Collision Detection II

Collision Detection. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Collision and Proximity Queries

Spatial Data Structures

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Collision Detection based on Spatial Partitioning

Spatial Data Structures

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Dynamic Collision Detection

Simulation in Computer Graphics Space Subdivision. Matthias Teschner

Collision Detection. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Lesson 05. Mid Phase. Collision Detection

improving raytracing speed

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Collision Detection CS434. Daniel G. Aliaga Department of Computer Science Purdue University

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

MSBVH: An Efficient Acceleration Data Structure for Ray Traced Motion Blur

Simulation (last lecture and this one)

Acceleration Data Structures

Geometric Queries for Ray Tracing

Lecture 11: Ray tracing (cont.)

Collision Detection. Motivation - Dynamic Simulation ETH Zurich. Motivation - Path Planning ETH Zurich. Motivation - Biomedical Simulation ETH Zurich

Barycentric Coordinates and Parameterization

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

CS770/870 Spring 2017 Ray Tracing Implementation

Computational Geometry

Line Arrangement. Chapter 6

Using Bounding Volume Hierarchies Efficient Collision Detection for Several Hundreds of Objects

Example: The following is an example of a polyhedron. Fill the blanks with the appropriate answer. Vertices:

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Curves D.A. Forsyth, with slides from John Hart

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Math 366 Lecture Notes Section 11.4 Geometry in Three Dimensions

CPSC GLOBAL ILLUMINATION

Collision Detection II. These slides are mainly from Ming Lin s course notes at UNC Chapel Hill

Chapter 8. Properties of Triangles and Quadrilaterals. 02/2017 LSowatsky

Line segment intersection. Family of intersection problems

Definitions. Topology/Geometry of Geodesics. Joseph D. Clinton. SNEC June Magnus J. Wenninger

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics

CS6100: Topics in Design and Analysis of Algorithms

Ray Tracing: Intersection

Simulation in Computer Graphics. Deformable Objects. Matthias Teschner. Computer Science Department University of Freiburg

Central issues in modelling

Overview. Collision Detection. A Simple Collision Detection Algorithm. Collision Detection in a Dynamic Environment. Query Types.

Motion Planning. O Rourke, Chapter 8

Ray Tracing Acceleration Data Structures

8.1 Geometric Queries for Ray Tracing

On the data structures and algorithms for contact detection in granular media (DEM) V. Ogarko, May 2010, P2C course

COMP 175: Computer Graphics April 11, 2018

Intersection Acceleration

Lecture 24 of 41. Collision Handling Part 1 of 2: Separating Axes, Oriented Bounding Boxes

Computer Graphics Ray Casting. Matthias Teschner

Topics. Ray Tracing II. Intersecting transformed objects. Transforming objects

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Spatial Data Structures

Geometric Modeling in Graphics

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

CSG obj. oper3. obj1 obj2 obj3. obj5. obj4

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Intersecting Simple Surfaces. Dr. Scott Schaefer

TDA361/DIT220 Computer Graphics, January 15 th 2016

VIII. Visibility algorithms (II)

Intro to Modeling Modeling in 3D

Accelerating Geometric Queries. Computer Graphics CMU /15-662, Fall 2016

Topics. Ray Tracing II. Transforming objects. Intersecting transformed objects

Virtual Environments

08: CONTACT MODELLING 15/02/2016

Polygon decomposition. Motivation: Art gallery problem

Geometric Computations for Simulation

Solid Modelling. Graphics Systems / Computer Graphics and Interfaces COLLEGE OF ENGINEERING UNIVERSITY OF PORTO

Geometric Modeling Mortenson Chapter 11. Complex Model Construction

The Topology of Bendless Orthogonal Three-Dimensional Graph Drawing. David Eppstein Computer Science Dept. Univ. of California, Irvine

Spatial Data Structures

Objects DO overlap. Objects DO NOT overlap. No calculations needed.

Geometry ~ Chapter 1 Capacity Matrix

Point A location in geometry. A point has no dimensions without any length, width, or depth. This is represented by a dot and is usually labelled.

Overview. Collision detection. Collision detection. Brute force collision detection. Brute force collision detection. Motivation

9. Visible-Surface Detection Methods

Polygon Partitioning. Lecture03

Algorithms for GIS:! Quadtrees

Continuous Collision Detection and Physics

A Different Approach for Continuous Physics. Vincent ROBERT Physics Programmer at Ubisoft

Glossary of dictionary terms in the AP geometry units

Differential Geometry: Circle Patterns (Part 1) [Discrete Conformal Mappinngs via Circle Patterns. Kharevych, Springborn and Schröder]

GEOMETRIC SEARCHING PART 1: POINT LOCATION

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Computer Graphics. Bing-Yu Chen National Taiwan University

Collision detection. Piotr Fulma«ski. 1 grudnia

Ray Intersection Acceleration

Ray Tracing Acceleration. CS 4620 Lecture 20

Spatial Data Structures

Computational Geometry [csci 3250]

Elements of 2d Computational Geometry. AI for Gaming Santa Clara, 2016

Lecture 18 Representation and description I. 2. Boundary descriptors

Collision detection. Piotr Fulma«ski. 19 pa¹dziernika Wydziaª Matematyki i Informatyki, Uniwersytet Šódzki, Polska

COMP331/557. Chapter 2: The Geometry of Linear Programming. (Bertsimas & Tsitsiklis, Chapter 2)

An iterative, octree-based algorithm for distance computation between polyhedra with complex surfaces 1

Transcription:

Collision handling: detection and response

Collision handling overview Detection Discrete collision detection Convex polygon intersection test General polygon intersection test Continuous collision detection Vertex triangle test Edge edge test Response Kinematic response Penalty method

Discrete Collision Handling Run the simulation from t to t+1, without considering collision Check if any intersection happens at t+1 If so, remove it

Geometric Modeling Primitives Point Line segment Polygon

Terminology convex and concave polygons

Edge Test Decides convex/concave Always on one side Not always on one side Works same for convex/concave polyhedra (always on on side of the polygonal face?)

An important property of Convex polygons! Initial Pair You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! No more improvement, done! You can always find the closest vertex pair by gradually moving one vertex at each time!

An important property of Convex polygons! The computational cost depends on the initial pair Worst case O(N) Best case O(1)! In animation, since we can keep the pair over time and the object movement within a time step is small, the initial pair is often good! O(1) Problem: not everything is convex Solution: decompose them into convex components Doesn t always work

General Polygon Intersection Tests To test whether two polygons intersect, we can To test whether two polygons intersect, we can test whether any vertex is inside of another

Inside/Outside Test To test whether a point is within a polygon/polyhedron, shoot a ray and count the intersections! Odd => inside; even =>outside 3 intersections > inside

Inside/Outside Test To test whether a point is within a polygon/polyhedron, shoot a ray and count the intersections! Odd => inside; even =>outside 1 intersection > inside

Inside/Outside Test To test whether a point is within a polygon/polyhedron, shoot a ray and count the intersections! Odd => inside; even =>outside 4 intersection > > outside

Inside/Outside Test To test whether a point is within a polygon/polyhedron, shoot a ray and count the intersections! Odd => inside; even =>outside 0 intersection > outside

Inside/Outside Test Doesn t always work 2 intersections but still inside? This is called a degenerate case. Solutions? Try some other directions 2 intersections???

Problem 1 (in 3D)? Collision can happen even there is no vertex inside of the other polyhedron. Called edge edge colllision The solution requires complex intersection tests. We skip it here

Discrete Collision Handling Run the simulation from t to t+1, without considering collision Check if any intersection happens at t+1 If so, remove it

Problem 2? Discrete collision handling has a tunneling artifact. No intersection at t or t+1,,but intersection happens in between. Time t Time t+1

Problem 3? To do inside/outside test, the object must be closed. In other words, it has an area (or volume). How do I know if two curves/surfaces are intersecting? Knowing the location of the intersection is not sufficient!

Solution We don t just check whether intersection happens at t or t+1. We check if any intersection happens between t and t+1. This is called continuous collision detection (opposing to ( pp g discrete collision detection).

For example: Vertex Triangle Test Four points P 0 (t)=p 0 +tv 0 ; P 1 (t)=p 1 +tv 1 ; P 2 (t)=p 2 +tv 2 ; P 3 (t)=p 3 +tv 3 Intersection happens when they are co planar (P 1 (t) P 0 (t)) (P 2 (t) P 0 (t)) (P 3 (t) P 0 (t))=0 Once you find t, verify if P 0 0( (t) is within the triangle. P1 P2 P0 P3

For example: Edge EdgeTestEdgeTest Four points P 0 (t)=p 0 +tv 0 ; P 1 (t)=p 1 +tv 1 ; P 2 (t)=p 2 +tv 2 ; P 3 (t)=p 3 +tv 3 Intersection happens when they are co planar (P 1 (t) P 0 (t)) (P 2 (t) P 0 (t)) (P 3 (t) P 0 (t))=0 Once you find t, verify if they do intersect! P1 P2 P0 P P3

Polygon and polyhedra complexity How many edges? How many points?

Bounding objects Sphere Axis aligned bounding box Oriented bounding box

Bounding volume construction Given a set of points as input, can we automatically create bounding volumes Axis aligned bounding box Sphere Convex hull

Axis aligned bounding box

Axis aligned bounding box (AABB)

Bounding sphere

Bounding sphere

Bounding sphere

Bounding sphere

Convex Hull Best fit convex polyhedron to concave polyhedron but takes some (one-time) computation 1. Find highest vertex, V1 2. Find remaining vertex that minimizes angle with horizontal plane through point. Call edge L 3. Form plane with this edge and horizontal line perpendicular to L at V1 4. Find remaining vertex that for triangle that minimizes angle with this plane. Add this triangle to convex hull, mark edges as unmatched thd 5. For each unmatched edge, find remaining vertex that minimizes angle with the plane of the edge s triangle 6. 3D convex hull is more complex

Convex hull

Convex hull

Convex hull

Convex hull

Convex hull

Convex hull

Convex hull

Bounding Slabs For better fit bounding polyhedron: use arbitrary (user-specified) collection of bounding plane- pairs Is a vertex between each pair? d N P 2 d 1

Sphere vs. Sphere Compare distance (p 1,p 2 ) to r 1 +r 2 distance(p 1,p 2 ) 2 to (r 1 + r 2 ) 2

AABB vs. AABB

AABB vs. AABB

Oriented bounding boxes and arbitrary polygons Separating axis theorem http://gamedev.tutsplus.com/tutorials/implement ation/collision detection with the separating axis the separating axis theorem/ http://www.sevenson.com.au/actionscript/sat/ http://www.metanetsoftware.com/technique/tut oriala.html

Hierarchical bounding volumes Approximating polyhedra with spheres for time critical collision detection, by Philip M. Hubbard

HBV example

HBV example

HBV example

Spatial subdivision grid (quadtrees and octrees)

Spatial subdivision binary space partitioning ii i

Collision response

Collisions: physics review Momentum p mv In a closed system, momentum is conserved p mv m'v' After a collision, the sum of all momentums is the same as the sum of all momentum before the collision

Collision types Elastic collisions no loss of kinetic energy (e.g. deformations, heat) Inelastic collisions loss of kinetic energy Kinetic energy 1 E mv 2 2

Elastic collision with stationary object: horizontal and vertical walls/planes l For vertical wall/boundary a/bouday Negate x component of velocity Preserve y component of velocity Ex: v 0 = (3, 3) ; v = ( 3, 3) For horizontal walls/boundaries Preserve x Negate y

Elastic collision with stationary object: Still split velocity vector into components Now with respect to the normal (n) of the wall u = (v * n / n * n) n Note: * is dot product Vector/direction is parallel to n Scalar/magnitude is in opposite direction of n; (v * n) < 0 w = v u Reflected velocity: v = w u angled ldwalls/planes l

Inelastic Collisions Coefficient of restitution ratio of velocities before and after collision (dampen the resulting velocity) Objects stick together, momentum is conserved

Collision response penalty method