Elllipsoids are defined by their local coordinates and three semi-axes.

Ellipsoid-Ellipsoid contact

Thsi algorithm is implemented in by woo.dem.Cg2_Ellipsoid_Ellipsoid_L6Geom.

Following [PRPrstgaardL96], we note semi-axes \(a_i\) and \(b_i\) as \(i\in\{1,2,3\}\); local axes are given as sets of orthonormal vectors \(\vec{u}_i\), \(\vec{v}_i\). The intercenter vector reads \(\vec{R}=\vec{r}_b-\vec{r}_a\), with \(\vec{r}_a\) and \(\vec{r}_b\) being positions of ellipsoid centroids. We define matrices

\begin{align*} \mat{A}&=\sum_{i=1}^{3} a_i^{-1}\vec{u}_i\vec{u}_i^T \\ \mat{B}&=\sum_{i=1}^{3} b_i^{-1}\vec{v}_i\vec{v}_i^T \end{align*}

which are both invertible for non-vanishing semi-axes; then we define the function


where \(\lambda\in[0,1]\) is an unknown parameter. The function \(S(\lambda)\) is concave and non-zero for \(\lambda\in[0,1]\) and zero at both end-points. It therefore has a sigle maximum. Using the Brent’s method, we obtain the maximum value \(\Lambda\) for which \(S(\Lambda)\) is maximal.


This computation can be (perhaps substantially) sped up by using other iterative methods, such as Newton-Raphson, finding root of \(S'(\lambda)\), and re-using the value from the previous step as the initial guess. There are also papers suggesting better algorithms such as [ZIPM09].

We define the Perram-Wertham potential (first introduced in [PW85]) as

\[F_{AB}=\{\max S(\lambda)|\lambda\in[0,1]\}=S(\Lambda)\]

for which ([PW85])

  • \(F_{AB}<1\) if both ellipsoids overlap,
  • \(F_{AB}=1\) if they are externaly tangent,
  • \(F_{AB}>1\) if the ellipsoids do not overlap.

[PW85] gives a geometrical interpretation of \(F_{AB}\), where


where \(\mu\) is scaling factor which must be applied to both ellipses to be tangent.

Following [DTS05] eq (18), we can compute the contact normal and the contact point of two ellipsoids as

\begin{align*} \vec{n}_c&=\mat{G}^{-1}\mat{R} \\ \vec{r}_c&=\vec{r}_a+(1-\Lambda)\mat{A}^{-1}\cdot \end{align*}

with \(\mat{G}\) defined in (1); note that \(\vec{n}_c\) is not normalized.

The penetration depth (overlap distance) can be reasoned out as follows. \(\mu\) scaled ellipsoid sizes while keeping their distance, so that they become externally tangent. Therefore \(1/\mu\) scales ellipsoid distance while keeping their sizes. With \(d=|\mat{R}|\) being the current inter-center distance, we obtain


This is the displacement that msut be performed along \(\vec{R}\) while the contact normal may be oriented differently; we therefore project \(u_n'\) along \(\vec{R}\) onto (normalized) \(\vec{n}_c\) obtaining


The \(u_n\), \(\normalized{\vec{n}}\), \(\vec{r}_c\) can be fed to Generic contact routine for further computation.

Ellipsoid-Wall intersection




Got questions? Ask at ask.woodem.org. Report issues to github.