# Collision between elliposids and a facets

0 votes
52 views
asked Oct 17, 2016

Hello Vaclav,

Is contact detection between ellipsoids and facets implemented? I tried a following code but it doesn't work (there is no interaction between an ellipsoid and a square):

import woo, woo.core
from woo.dem import *
from minieigen import *

S = woo.master.scene=woo.core.Scene(fields=[woo.dem.DemField(gravity=(0,0,-9.81))])

square = woo.triangulated.quadrilateral(Vector3(-0.1, -0.1,0.0), Vector3(-0.1, 0.1, 0), Vector3(0.1, -0.1, 0.0), Vector3(0.1, 0.1, 0.0))
S.dem.par.add(square)
ellipsoid = woo.utils.ellipsoid(center=(0,0,0.2),semiAxes=(0.05, 0.025, 0.025))
S.dem.par.add(ellipsoid)

wall=woo.dem.Wall.make(-0.2,axis=2)
S.dem.par.add(wall)

S.engines=DemField.minimalEngines(damping=.3)
S.throttle=5e-3

What I am missing?

Regards

Piotrek

## 1 Answer

0 votes
answered Oct 17, 2016 by (44,890 points)

Hi Piotrek,

you are not missing something, it is simply not implented.

Actually there is some attempt done (see the table https://woodem.org/theory/geom/index.html#particle-shapes, which leads you to https://woodem.org/woo.dem.html#woo.dem.Cg2_Facet_Ellipsoid_L6Geom) but if you look at the source code (https://github.com/woodem/woo/blob/master/pkg/dem/Ellipsoid.cpp#L133) you will see what is happening.

The theory on ellipsoid is in https://woodem.org/theory/geom/ellipsoid.html , intersection with infinite plane is quite easy, but I have not found any easy algorithm which will find points of smallest distance between ellipsoid and line (signed negative distance in case of interpenetration). If you want to implement it, I will support you - it is just some math.

An implementation of ellipsoid-line (or ellipsoid-cylinder) would be a good start; the facet it then straightforward (plane, which is done, and 3 segments, which is easy once lines are working).

Cheers, Vaclav

commented Oct 18, 2016 by (120 points)

Hi Vaclav,
Thank you for your reply.
I must deeper look into the theory. So, now I only have one question. Refering to the smallest distance between an ellipsoid and a line, do you have in mind the distance along a vector normal to the ellipsoid or the distance along a vector perpendicular to the line? It seems to me that they are not the same in a general case.

commented Oct 18, 2016 by (44,890 points)

As I see it (maybe I am mistaken): (1) the minimum exists and is unique (assuming Euclidean metric etc; the ellipsoid is strictly convex), ergo (2) the distance gradient must be zero both on the line and the ellipsoid (otherwise it would not be minimum, right?), thus the connecting segment will be perpendicular to both the line and the tangent plane. PS useful links (ray and ellipsoid)https://www.geometrictools.com/Source/Distance3D.html and http://math.stackexchange.com/questions/89505/analytically-compute-signed-distance-of-ellipsoid (not for line, but still useful).