pub struct Frame3 {
pub origin: Point3,
pub x: Vec3,
pub y: Vec3,
pub z: Vec3,
}Expand description
An orthonormal reference frame: origin + three mutually perpendicular unit
axes (x, y, z).
The z axis is the primary direction (surface normal, curve axis, etc.).
x and y span the plane perpendicular to z.
Fields§
§origin: Point3Frame origin.
x: Vec3First axis in the perpendicular plane.
y: Vec3Second axis in the perpendicular plane.
z: Vec3Primary axis / normal.
Implementations§
Source§impl Frame3
impl Frame3
Sourcepub fn from_normal(origin: Point3, normal: Vec3) -> Result<Self, MathError>
pub fn from_normal(origin: Point3, normal: Vec3) -> Result<Self, MathError>
Build an orthonormal frame from an origin and a primary axis (normal).
x and y are chosen arbitrarily in the plane perpendicular to z.
The input normal is normalized internally.
§Errors
Returns MathError::ZeroVector if normal is zero-length.
Sourcepub fn from_normal_and_ref(
origin: Point3,
normal: Vec3,
ref_dir: Vec3,
) -> Result<Self, MathError>
pub fn from_normal_and_ref( origin: Point3, normal: Vec3, ref_dir: Vec3, ) -> Result<Self, MathError>
Build an orthonormal frame from an origin, a primary axis, and a
preferred reference direction for x.
ref_dir is projected onto the plane perpendicular to z to produce
x. If ref_dir is (nearly) parallel to z, the frame falls back to
an arbitrary perpendicular choice.
§Errors
Returns MathError::ZeroVector if normal is zero-length.