pub struct R2 {
pub x: Rational,
pub y: Rational,
}Expand description
Exact 2D point (or vector). Derived Ord is lexicographic, which the
arrangement code uses for exact point dedup in BTree maps.
Fields§
§x: Rational§y: RationalImplementations§
Source§impl R2
impl R2
pub fn new(x: Rational, y: Rational) -> Self
pub fn from_vec2(v: Vec2) -> Self
pub fn to_vec2_rounded(&self) -> Vec2
pub fn sub(&self, o: &R2) -> R2
pub fn add(&self, o: &R2) -> R2
pub fn scale(&self, s: &Rational) -> R2
pub fn dot(&self, o: &R2) -> Rational
Sourcepub fn cross(&self, o: &R2) -> Rational
pub fn cross(&self, o: &R2) -> Rational
2D cross product (z of the 3D cross of the embedded vectors).
pub fn is_zero(&self) -> bool
Trait Implementations§
impl Eq for R2
Source§impl Ord for R2
impl Ord for R2
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for R2
impl PartialOrd for R2
impl StructuralPartialEq for R2
Auto Trait Implementations§
impl Freeze for R2
impl RefUnwindSafe for R2
impl Send for R2
impl Sync for R2
impl Unpin for R2
impl UnsafeUnpin for R2
impl UnwindSafe for R2
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
Mutably borrows from an owned value. Read more