Expand description
A point.
Doesn’t guarantee to be finite.
Fields
x: f32
y: f32
Implementations
sourceimpl Point
impl Point
sourcepub fn from_f32x2(r: f32x2) -> Point
pub fn from_f32x2(r: f32x2) -> Point
Creates a new Point
from f32x2
.
sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if both x and y are measurable values.
Both values are other than infinities and NaN.
sourcepub fn normalize(&mut self) -> bool
pub fn normalize(&mut self) -> bool
Scales (fX, fY) so that length() returns one, while preserving ratio of fX to fY, if possible.
If prior length is nearly zero, sets vector to (0, 0) and returns false; otherwise returns true.
sourcepub fn set_normalize(&mut self, x: f32, y: f32) -> bool
pub fn set_normalize(&mut self, x: f32, y: f32) -> bool
Sets vector to (x, y) scaled so length() returns one, and so that (x, y) is proportional to (x, y).
If (x, y) length is nearly zero, sets vector to (0, 0) and returns false; otherwise returns true.
sourcepub fn set_length(&mut self, length: f32) -> bool
pub fn set_length(&mut self, length: f32) -> bool
Scales vector so that distanceToOrigin() returns length, if possible.
If former length is nearly zero, sets vector to (0, 0) and return false; otherwise returns true.
sourcepub fn set_length_from(&mut self, x: f32, y: f32, length: f32) -> bool
pub fn set_length_from(&mut self, x: f32, y: f32, length: f32) -> bool
Sets vector to (x, y) scaled to length, if possible.
If former length is nearly zero, sets vector to (0, 0) and return false; otherwise returns true.
sourcepub fn cross(&self, other: Point) -> f32
pub fn cross(&self, other: Point) -> f32
Returns the cross product of vector and vec.
Vector and vec form three-dimensional vectors with z-axis value equal to zero. The cross product is a three-dimensional vector with x-axis and y-axis values equal to zero. The cross product z-axis component is returned.
Trait Implementations
sourceimpl AddAssign<Point> for Point
impl AddAssign<Point> for Point
sourcefn add_assign(&mut self, other: Point)
fn add_assign(&mut self, other: Point)
Performs the +=
operation. Read more
sourceimpl MulAssign<Point> for Point
impl MulAssign<Point> for Point
sourcefn mul_assign(&mut self, other: Point)
fn mul_assign(&mut self, other: Point)
Performs the *=
operation. Read more
sourceimpl PartialEq<Point> for Point
impl PartialEq<Point> for Point
sourceimpl SubAssign<Point> for Point
impl SubAssign<Point> for Point
sourcefn sub_assign(&mut self, other: Point)
fn sub_assign(&mut self, other: Point)
Performs the -=
operation. Read more
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more