pub struct Point(pub [Scalar; 2]);
Expand description
Value representing a 2D point or vector.
Tuple Fields§
§0: [Scalar; 2]
Implementations§
source§impl Point
impl Point
pub const fn new(x: Scalar, y: Scalar) -> Self
sourcepub fn normalize(self) -> Option<Point>
pub fn normalize(self) -> Option<Point>
Convert vector to a unit size vector, if length is not zero
sourcepub fn angle_between(self, other: Self) -> Option<Scalar>
pub fn angle_between(self, other: Self) -> Option<Scalar>
Calculate angle (from self to the other) between two vectors
sourcepub fn cos_between(self, other: Self) -> Option<Scalar>
pub fn cos_between(self, other: Self) -> Option<Scalar>
Cosine of the angle (from self to the other) between to vectors
sourcepub fn sin_between(self, other: Self) -> Option<Scalar>
pub fn sin_between(self, other: Self) -> Option<Scalar>
Sine of the angle (from self to the other) between to vectors
sourcepub fn is_close_to(self, other: Point) -> bool
pub fn is_close_to(self, other: Point) -> bool
Determine if self is close to the other within the margin of error (EPSILON)
Trait Implementations§
source§impl<'de> Deserialize<'de> for Point
impl<'de> Deserialize<'de> for Point
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Point
impl PartialEq for Point
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
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