tetraVolume

pyvsim.Utils.tetraVolume(p1, p2, p3, p4)[source]

Calculates the volume of a tetrahedron. This is simply the unrolled determinant:

\[\begin{split}\left [ \begin{array}{ccc} V_{x,1} & V_{y,1} & V_{z,1} \\ V_{x,2} & V_{y,2} & V_{z,2} \\ V_{x,3} & V_{y,3} & V_{z,3} \end{array} \right ] \cdot {1 \over 6}\end{split}\]

With:

\[\vec{V}_1 = \vec{P}_1 - \vec{P}_4\]\[\vec{V}_2 = \vec{P}_2 - \vec{P}_4\]\[\vec{V}_3 = \vec{P}_3 - \vec{P}_4\]

This function works only for list of vectors, for performance reasons will not check the inputs, will throw an error instead.

(This works faster than numpy.linalg.det repeated over the list of tetrahedrons)

Parameters :

p1, p2, p3, p4 : numpy.ndarray \((N,3)\)

The points of the N tetrahedrons.

Returns :

v : numpy.ndarray \((N)\)

The volume of the tetrahedrons.

This Page