pub struct SourceFrame { /* private fields */ }Expand description
A source coordinate frame described in world terms: world[i] = sign_i * source[axes[i]] * metres_per_unit
for positions, without the scale for directions.
Implementations§
Source§impl SourceFrame
impl SourceFrame
Sourcepub const WORLD: SourceFrame
pub const WORLD: SourceFrame
The world frame itself.
Sourcepub const ENU: SourceFrame
pub const ENU: SourceFrame
East, north, up, metres (right-handed, z up): a source’s own frame, one writer’s internal frame, and
Blender’s. world = (east, up, -north); back out, (east, north, up) = (x, -z, y).
Sourcepub const fn new(axes: [Axis; 3], metres_per_unit: f64) -> SourceFrame
pub const fn new(axes: [Axis; 3], metres_per_unit: f64) -> SourceFrame
A frame from constant parts. Panics (a compile error in a const) when the axes are not a permutation or the
scale is not finite and positive: frames written in code are checked where they are written. For frames read
from data use SourceFrame::try_new.
pub const fn try_new( axes: [Axis; 3], metres_per_unit: f64, ) -> Result<SourceFrame, FrameError>
Sourcepub const fn axes(&self) -> [Axis; 3]
pub const fn axes(&self) -> [Axis; 3]
For world axis i, the source axis (with sign) it is taken from.
pub const fn metres_per_unit(&self) -> f64
Sourcepub const fn determinant(&self) -> i32
pub const fn determinant(&self) -> i32
The determinant of the axis part: +1 when the source is right-handed like the world, -1 when it is left-handed (converting mirrors).
Sourcepub const fn flips_winding(&self) -> bool
pub const fn flips_winding(&self) -> bool
Whether converting a mesh mirrors it, so its triangles’ winding must be reversed to keep their fronts.
Sourcepub const fn inverse(&self) -> SourceFrame
pub const fn inverse(&self) -> SourceFrame
The world frame described in this frame’s terms: converting with the inverse undoes a conversion.
Sourcepub fn direction(&self, d: [f32; 3]) -> [f32; 3]
pub fn direction(&self, d: [f32; 3]) -> [f32; 3]
A direction (normal, tangent, axis): signed permutation only, bit-exact.
Sourcepub fn point(&self, p: [f32; 3]) -> [f32; 3]
pub fn point(&self, p: [f32; 3]) -> [f32; 3]
A position: signed permutation, then the unit scale (f64, rounded once; exact for scale 1).
Sourcepub fn transform(&self, m: &Transform) -> Transform
pub fn transform(&self, m: &Transform) -> Transform
A transform world = M * local whose local and world sides are both in this frame: C M C^-1. The linear
part only moves and negates entries (bit-exact; the scale cancels), the translation converts as a point.
Sourcepub fn direction_to_source(&self, d: [f32; 3]) -> [f32; 3]
pub fn direction_to_source(&self, d: [f32; 3]) -> [f32; 3]
World to this frame: the inverse conversions.
pub fn point_to_source(&self, p: [f32; 3]) -> [f32; 3]
pub fn transform_to_source(&self, m: &Transform) -> Transform
Sourcepub fn length_to_source(&self, l: f32) -> f32
pub fn length_to_source(&self, l: f32) -> f32
A length in metres, in this frame’s units (exact for scale 1).
Sourcepub fn inverse_length_to_source(&self, l: f32) -> f32
pub fn inverse_length_to_source(&self, l: f32) -> f32
One over a length in metres, in this frame’s units (exact for scale 1).
Sourcepub fn tangent_to_source(&self, t: [f32; 4]) -> [f32; 4]
pub fn tangent_to_source(&self, t: [f32; 4]) -> [f32; 4]
A tangent (xyz, w the bitangent sign) in this frame: xyz as a direction, w negated where the frame mirrors.
Sourcepub fn plane_to_source(&self, plane: [f32; 4]) -> [f32; 4]
pub fn plane_to_source(&self, plane: [f32; 4]) -> [f32; 4]
A plane (n, d) (dot(n, p) + d = 0 for its world points p) in this frame: the normal as a direction, the
offset as a length.
Sourcepub fn from_world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
pub fn from_world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
A 4 x 4 matrix (by columns) that takes world positions to another space (the view, the clip), made to take this
frame’s positions to the same space: M C, C this frame’s map to the world, so (M C) (C^-1 p) = M p and
what it gives is unchanged. Column j of M C is the column of M for the world axis this frame’s axis j
is, signed and times the unit scale: for scale 1 the entries only move and change sign (bit-exact), and the
product with a converted point sums the same terms in this frame’s axis order (the same order, so the same
bits, for a frame that only changes signs).
Sourcepub fn to_world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
pub fn to_world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
A 4 x 4 matrix (by columns) that gives world positions (from the view, the clip), made to give this frame’s:
C^-1 M, each column’s xyz converted as a point and its w kept.
Sourcepub fn world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
pub fn world_matrix_to_source(&self, m: [[f32; 4]; 4]) -> [[f32; 4]; 4]
A 4 x 4 matrix (by columns) from one world-frame space to another (an object’s to the world, a joint’s) in this
frame’s terms: C^-1 M C, as SourceFrame::transform_to_source converts an affine transform.
Trait Implementations§
Source§impl Clone for SourceFrame
impl Clone for SourceFrame
impl Copy for SourceFrame
Source§impl Debug for SourceFrame
impl Debug for SourceFrame
Source§impl PartialEq for SourceFrame
impl PartialEq for SourceFrame
impl StructuralPartialEq for SourceFrame
Source§impl VertexMap for SourceFrame
A frame conversion moves a mesh’s streams as it moves positions and directions: normals and tangents by the signed
permutation (a uniform scale turns no direction), a tangent’s bitangent sign negated where the conversion mirrors.
impl VertexMap for SourceFrame
A frame conversion moves a mesh’s streams as it moves positions and directions: normals and tangents by the signed permutation (a uniform scale turns no direction), a tangent’s bitangent sign negated where the conversion mirrors.