pub struct Frame2 { /* private fields */ }Expand description
An orthonormal frame in a surface’s (u, v) plane, of either handedness.
A pcurve placed by a left-handed Frame2 is traversed clockwise in
(u, v) — the case of a circle shared by a cap and a wall whose normal
opposes the circle’s Z (docs/DATA-MODEL.md §Pcurves).
use arris_math::{Frame2, Handedness, Point2, Vec2};
let f = Frame2::new(Point2::new(1.0, 1.0), Vec2::new(0.0, 2.0), Handedness::Left).unwrap();
assert!(!f.is_right_handed());
assert_eq!(f.y().into_inner(), Vec2::new(1.0, 0.0));
assert_eq!(f.to_world(Point2::new(1.0, 1.0)), Point2::new(2.0, 2.0));Implementations§
Source§impl Frame2
impl Frame2
Sourcepub fn new(
origin: Point2,
x: Vec2,
handedness: Handedness,
) -> Result<Self, FrameError>
pub fn new( origin: Point2, x: Vec2, handedness: Handedness, ) -> Result<Self, FrameError>
A frame with x along x (normalised) and y perpendicular to it
on the side handedness says. Errors: a non-finite input or a zero
x.
Sourcepub fn from_orthonormal(
origin: Point2,
x: Vec2,
y: Vec2,
) -> Result<Self, FrameError>
pub fn from_orthonormal( origin: Point2, x: Vec2, y: Vec2, ) -> Result<Self, FrameError>
A frame from axes that already are one — each unit and
perpendicular to rounding (crate::RELATIVE_ROUNDING), of either
handedness — stored bit for bit; what the native format reads a
Frame2 back through. Errors: a non-finite input, or
FrameError::NotOrthonormal.
Sourcepub fn translated(&self, by: Vec2) -> Frame2
pub fn translated(&self, by: Vec2) -> Frame2
The same axes at the origin moved by by.
use arris_math::{Frame2, Point2, Vec2};
let f = Frame2::identity().translated(Vec2::new(1.0, 2.0));
assert_eq!(f.origin(), Point2::new(1.0, 2.0));
assert_eq!(f.x(), Frame2::identity().x());Sourcepub fn handedness(&self) -> Handedness
pub fn handedness(&self) -> Handedness
Which way y turns from x.
Sourcepub fn is_right_handed(&self) -> bool
pub fn is_right_handed(&self) -> bool
true when x × y > 0, the (u, v) plane’s own orientation.
Sourcepub fn vec_to_local(&self, v: Vec2) -> Vec2
pub fn vec_to_local(&self, v: Vec2) -> Vec2
The components of a (u, v) vector along the axes.
Sourcepub fn vec_to_world(&self, v: Vec2) -> Vec2
pub fn vec_to_world(&self, v: Vec2) -> Vec2
The (u, v) vector with local components v.
Trait Implementations§
impl Copy for Frame2
impl StructuralPartialEq for Frame2
Auto Trait Implementations§
impl Freeze for Frame2
impl RefUnwindSafe for Frame2
impl Send for Frame2
impl Sync for Frame2
impl Unpin for Frame2
impl UnsafeUnpin for Frame2
impl UnwindSafe for Frame2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.