pub struct Frame3 {
pub origin: Point3,
pub x: UnitVec3,
pub y: UnitVec3,
pub z: UnitVec3,
}Expand description
Right-handed orthonormal frame: origin + three unit axes.
x, y, z form a right-handed basis: x.cross(y) == z.
Fields§
§origin: Point3Frame origin in world space.
x: UnitVec3Local X axis.
y: UnitVec3Local Y axis.
z: UnitVec3Local Z axis (= x × y).
Implementations§
Source§impl Frame3
impl Frame3
Sourcepub fn from_origin_z(origin: Point3, forward: UnitVec3) -> Self
pub fn from_origin_z(origin: Point3, forward: UnitVec3) -> Self
Build a frame from an origin and a forward (+Z) direction.
The X axis is chosen to be perpendicular to forward (arbitrary but
consistent). Y is derived as z × x (right-handed).
Sourcepub fn from_origin_z_up(
origin: Point3,
forward: UnitVec3,
up_hint: Vec3,
) -> Self
pub fn from_origin_z_up( origin: Point3, forward: UnitVec3, up_hint: Vec3, ) -> Self
Build a frame from origin, forward (+Z), and a suggested up vector.
up_hint need not be perpendicular to forward; it is projected to
produce the Y axis. Falls back to the arbitrary-perp method if up_hint
is nearly parallel to forward.
Sourcepub fn to_local_point(self, p: Point3) -> Point3
pub fn to_local_point(self, p: Point3) -> Point3
Express a world-space point in local coordinates.
Sourcepub fn to_world_point(self, p: Point3) -> Point3
pub fn to_world_point(self, p: Point3) -> Point3
Express a local-space point in world coordinates.
Sourcepub fn to_local_vec(self, v: Vec3) -> Vec3
pub fn to_local_vec(self, v: Vec3) -> Vec3
Express a world-space vector in local coordinates.
Sourcepub fn to_world_vec(self, v: Vec3) -> Vec3
pub fn to_world_vec(self, v: Vec3) -> Vec3
Express a local-space vector in world coordinates.