`woo.comp`

¶

Expose interal utility c++ functions for computing volume, centroids, inertia, coordinate transforms; mostly used for testing.

- woo.comp.cart2cyl()¶
Convert cartesian coordinates to cylindrical; cylindrical coordinates are specified as \((r,\theta,z)\), the reference plane is the \(xy\)-plane (see at Wikipedia).

- woo.comp.computePrincipalAxes()¶
Return (

*pos*,*ori*,*inertia*) of new coordinate system (relative to the current one), whose axes are principal, i.e. second-order momentum is diagonal (the diagonal is returned in*inertia*, which is sorted to be non-decreasing). The arguments are volume (mass)*V*, first-order momentum*Sg*and second-order momentum*Ig*. If*Sg*is`(0,0,0)`

, the reference point will not change, only rotation will occur.

- woo.comp.cyl2cart()¶
Convert cylindrical coordinates to cartesian; cylindrical coordinates are specified as \((r,\theta,z)\), the reference plane is the \(xy\)-plane (see at Wikipedia).

- woo.comp.inertiaTensorTranslate()¶
Tensor of inertia of solid translated by

*off*with previous inertia \(I\), volume \(V\); if \(V\) is positive, the translation is away from the centroid, if negative, towards the centroid. The computation implements Parallel axes theorem.

- woo.comp.tetraInertia()¶
Tetrahedron inertia from covariance. If

*fixSign*is true, the tensor is multiplied by -1 if the (0,0) entry is negative (this is caued by non-canonical vertex ordering).

- woo.comp.tetraInertia_grid()¶
Tetrahedron inertia from grid sampling (

*div*gives subdivision along the shortest aabb side).

- woo.comp.tetraVolume()¶
Volume of tetrahedron, computed as \(\frac{1}{6}((A-B)\cdot(B-D)))\times(C-D)\).

- woo.comp.triangleArea()¶

- woo.comp.triangleInertia()¶

- woo.comp.uniformResamplePiecewiseLinear()¶
Resample piecewise-linear function (given by points

*xx*and*yy*, where*xx*is non-decreasing) using a uniform grid with endpoints*xRange*and*div*points (*div*-1 pieces), returning linearly interpolated value of*yy*in *div*+1 points.

Tip

Report issues or inclarities to github.