computer graphics & visualization collision detection – narrow phase
TRANSCRIPT
![Page 1: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/1.jpg)
computer graphics & visualization
Simulation and Animation
Collision Detection – Narrow Phase
![Page 2: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/2.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Collision DetectionBroad Phase
Narrow Phase
Detection
![Page 3: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/3.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Where do bodies hit each other?• Bodies described by polyhedra• Rigid bodies
• 2 cases:– Vertex/Face
example: cube on table, 4 Vertex/Face contacts for 4 cube vertices
– Edge/Edge:example: cube protrudes over table, 2 Vertex/Face contacts and 2 Edge/Edge contacts with desk edge
![Page 4: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/4.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Describing the contact:– Involved bodies– Contact point in world coordinates– Collision normal• Face normal in case of Vertex/Face contact • Cross product between edge vectors in case of Edge/Edge
contact
![Page 5: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/5.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Discretization problem– Contact detection at simulation time step– Collision has to consider
time constraints 4D problem
t t + 1
Contact occurs, but might be missed due to fix time discretization of simulation
![Page 6: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/6.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Basic algorithms for collision detection– Detecting collision occurence – Detecting point of contact– Modelling a response
• Most common in games:– Broad/Narrow phase algorithms
• Broad phase: reject objects that cannot collide– Bsp-Trees, Bounding volume hiearchies, separating axes
• Narrow phase: Apply accurate collision detection– Polyhedron/Polyhedron, closest features
![Page 7: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/7.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Narrow phase collision detection– (Convex) polyhedron/polyhedron test
• Any vertex of either object is contained in the other one v: vertex, u: vertex on face, n: outward facing normal
• Penetration between edges and faces– If shortest distance between edge points changes sign– Compute intersection points between edges and infinite planes
– Sort intervals and test their points as above• Check for exactly aligned objects
iii nuv )(
)(
)()(
iji
ji
i
kkjjkkii
vvtvxdd
dt
nuvdnuvd
![Page 8: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/8.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Narrow Phase between triangles
1
011
10
12
10
111
111
12
11
101
0:
VNd
VVVVN
dXN
VVVT
10V
11V
12V 1
2
Step 1: Compute plane equations
![Page 9: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/9.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Narrow Phase between triangles
12
21
12
11
12
01
111
22
21
202
12
11
101
22
21
20
0:
dVNd
dVNd
dVNd
dXN
VVVT
VVVT
V
V
V
10V
11V
12V 1
2
Step 2: Compute vertex-to-plane distancesand look for sign change
also compute vice versa distances
![Page 10: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/10.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Narrow Phase between triangles• Narrow phase collision detection between triangles– Test for overlapping intervals along plane-plane intersection
L L
L=O+tDD=N1×N2
![Page 11: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/11.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Narrow Phase between triangles
t1 t2K0,1 K1,1
V1,1
V0,1 V2,1
π1
π2
L
pv,1,1=D (V∙ 1,1-O)
pv,0,1=D (V∙ 0,1-O)
d0,1
d1,1
)( 11
01
01
11
01
01
1
vv
vv
v
v
dd
pp
d
pt
11
01
01
01
11
01
1
vv
v
vvv dd
dpppt
![Page 12: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/12.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Optimizations• Interval shift does not influence overlap
avoid computation of O and replace by
• Projection of L onto an arbitrary axis does not influence overlap
3,2,1,11 iVDp iVi
1iV
p
3,2,1,
,,max if
,,max if
,,max if
1
1
1
1
i
DDDDV
DDDDV
DDDDV
p
zyxziz
zyxyiy
zyxxix
Vi
![Page 13: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/13.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Narrow phase collision detection between triangles– Based on axial projections– Triangles have normals N, M and edges Ei, Fj
– Compute plane equation p0,p1 of triangle 0,1• If both triangles are parallel - reject • If both triangles are coplanar – 2D (overlap/in-out)-test
– Compute distances of vertices of 1,0 to p0,p1• If all distances have same sign - reject
– General case: intersection is a line L (o+td, d=NxM)• Compute projections of vertices onto L: (d·(v-o))• Compute projections of vertices onto p0,p1• Compute intervals from similarity observation
![Page 14: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/14.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Space-Time constraints– Consider time discretization, e.g. bounding spheres • Size of smallest sphere determined by time step of
simulation and maximal velocity• Spheres are taken from smaller object
– Collisions between dynamic and static objects• Consider velocity of moving objects• Predict first collision within given time interval• Only if collision occurs, tree model has to be processed
recursively
![Page 15: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/15.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Dynamically moving sphere and plane
– Sphere of radius r and center C(t) = C(0) + t V– Plane equation: NX=d– Check for collision in time interval t [0,tmax]– Distance(center, plane): |NC(t)-d|– First time of contact: |NC(T)-d| = r
• T<0: sphere moves away• T>0: sphere will intersect at position C(T)
VN
rVNsignCNdT
)()0(
![Page 16: Computer graphics & visualization Collision Detection – Narrow Phase](https://reader035.vdocuments.site/reader035/viewer/2022081515/56649db15503460f94a9fade/html5/thumbnails/16.jpg)
computer graphics & visualization
Simulation and Animation – SS 07Jens Krüger – Computer Graphics and Visualization Group
Contact • Dynamically moving box and plane– Project box half-sizes onto normal line of plane– Take projected value as radius of a sphere– Apply sphere-plane test from above– Finding intersection point is more complex• Depends on box orientation - face, line or vertex