mirror of
https://github.com/mpusz/mp-units.git
synced 2026-07-08 09:30:52 +02:00
805bb969d2
`embed` is the canonical inclusion of the plane into space and `project` the canonical projection back, for both vectors and tensors: - vector: embed (x,y) -> (x,y,0); project (x,y,z) -> (x,y) - tensor: embed the 2x2 into the top-left block of a zeroed 3x3; project keeps that top-left 2x2 block They are explicit named free functions (no implicit cross-dimension conversion), each defined for a single source dimension (embed: 2D only; project: 3D only). The zero fill is the additive identity derived from a component (`x - x`), so no value-initialization of the element type is required. Also route `tensor_product` through `cartesian_tensor_from` instead of a default-constructed result, matching the other constructing operations (the element type need not be default-constructible). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>