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

woo.comp.
cart2cyl
((Vector3)xyz) → Vector3 :¶ 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
((float)V, (Vector3)Sg, (Matrix3)Ig) → tuple :¶ Return (pos, ori, inertia) of new coordinate system (relative to the current one), whose axes are principal, i.e. secondorder momentum is diagonal (the diagonal is returned in inertia, which is sorted to be nondecreasing). The arguments are volume (mass) V, firstorder momentum Sg and secondorder momentum Ig. If Sg is
(0,0,0)
, the reference point will not change, only rotation will occur.

woo.comp.
cyl2cart
((Vector3)rThetaZ) → Vector3 :¶ 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
((Matrix3)I, (float)V, (Vector3)off) → Matrix3 :¶ 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
((Vector3)A, (Vector3)B, (Vector3)C, (Vector3)D[, (bool)fixSign=True]) → Matrix3 :¶ 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 noncanonical vertex ordering).

woo.comp.
tetraInertia_grid
((Vector3)A, (Vector3)B, (Vector3)C, (Vector3)D[, (int)div=100]) → Matrix3 :¶ Tetrahedron inertia from grid sampling (div gives subdivision along the shortest aabb side).

woo.comp.
tetraVolume
((Vector3)A, (Vector3)B, (Vector3)C, (Vector3)D) → float :¶ Volume of tetrahedron, computed as \(\frac{1}{6}((AB)\cdot(BD)))\times(CD)\).

woo.comp.
triangleArea
((Vector3)arg1, (Vector3)arg2, (Vector3)arg3) → float¶

woo.comp.
triangleInertia
((Vector3)arg1, (Vector3)arg2, (Vector3)arg3) → Matrix3¶

woo.comp.
uniformResamplePiecewiseLinear
((object)xx, (object)yy, (Vector2)xRange, (int)div) → object :¶ Resample piecewiselinear function (given by points xx and yy, where xx is nondecreasing) using a uniform grid with endpoints xRange and div points (div1 pieces), returning linearly interpolated value of yy in *div*+1 points.
Tip
Got questions? Ask at ask.woodem.org. Report issues to github.