# Sphere-Facets penetrationDepth

Hello,

Can I have a question about the calculation of penetration depth in the case of an interaction sphere with two facets?
How it works?

Code below:

import math

# Spheres
color = [0.21, 0.22, 0.1]
r = 1.
sf = 3 # scale factor
trans = 0.2

sphere1 = sphere([0.8, 0., 0.], r, color=color, fixed=fixed),
sphere2 = sphere([2.6, 0., 0.], r, color=color, fixed=fixed),
sphere3 = sphere([0.8, -1.8, 0.], r, color=color, fixed=fixed),
sphere4 = sphere([0.8, -3.6, 0.], r, color=color, fixed=fixed),
side1 = facet(vertices=[(0.0, -2*r*sf, 0.),
(0.0, trans, 2*r*sf),
(0.0, trans, -2*r*sf)], fixed=True, wire=True),
side2 = facet(vertices=[(0.0, 2*r*sf, 0.),
(0.0, trans, 2*r*sf),
(0.0, trans, -2*r*sf)], fixed=True, wire=True)
O.bodies.append(sphere3)
O.bodies.append(side1)
O.bodies.append(side2)
O.bodies.append(sphere2)
O.bodies.append(sphere1)
O.bodies.append(sphere4)

# Solver
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Box_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Box_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.1),
PyRunner(command='intCounter()', realPeriod=1),
PyRunner(command='testVF()', realPeriod=1)
]
# Make a step
O.step()

#for i in O.interactions:
# print(i.geom.penetrationDepth)
# print(i.geom.contactPoint)

########

v = qt.View()
v.axes = True

Sphere1 has interaction with Side1 and Side2.

BR
Przemek

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-10-29
Last query:
2020-10-29
2020-10-28

## This question was reopened Jan Stránský (honzik) said on 2020-10-28: #1

Hello,

> calculation ... in the case of an interaction sphere with two facets?

each interaction is solved independently

> How it works?

have a look at the source code . penetrationDepth is computed w.r.t type of contact (vertex, edge, face), "naturally" (what one would expect).

cheers
Jan

 Przemek (przemekn) said on 2020-10-29: #2

Thanks Jan Stránský, that solved my question.