affine
Moving a solid · api.md § affine · all operations
definition
affine(s: Solid, matrix: Number[3][4]) -> Solid
Maps the solid by p ↦ M·p + t, where the rows of matrix are [M | t]. M may be any matrix with a nonzero determinant: a stretch along any axes, a shear, a mirror, or a similarity.
The result's volume is |det M| times the solid's, and its centroid is M·c + t. A point lies inside the result exactly when its preimage lies inside the solid. A surface element grows by the factor |det M|·|M⁻ᵀ n|. For singular values σ₁ ≥ σ₂ ≥ σ₃, that factor lies between σ₂σ₃ and σ₁σ₂, so the result's area lies between σ₂σ₃ times and σ₁σ₂ times the solid's area. A cylinder, sphere or torus that is stretched unevenly is no longer a cylinder, sphere or torus, and a kernel may carry such a face as a spline.
Example. Solid 1 is a 10 × 20 × 30 mm box with one corner at the origin.
> {"cmd": "affine", "s": 1, "matrix": [[2, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0.5, 0]]}
< {"ok": 2}