# Collision between elliposids and a facets

111 views

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))
ellipsoid = woo.utils.ellipsoid(center=(0,0,0.2),semiAxes=(0.05, 0.025, 0.025))

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

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

What I am missing?

Regards

Piotrek

answered Oct 17, 2016 by (48,170 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,