pub struct Vector {
pub x: f32,
pub y: f32,
}
Expand description
Two dimensional vector.
Fields§
§x: f32
§y: f32
Implementations§
source§impl Vector
impl Vector
sourcepub fn length_squared(self) -> f32
pub fn length_squared(self) -> f32
Returns the squared length of the vector.
sourcepub fn distance_to(self, other: Self) -> f32
pub fn distance_to(self, other: Self) -> f32
Returns the distance between two points.
sourcepub fn ceil(self) -> Self
pub fn ceil(self) -> Self
Returns a new vector containing the smallest integer values greater than or equal to each component.
sourcepub fn floor(self) -> Self
pub fn floor(self) -> Self
Returns a new vector containing the largest integer values less than or equal to each component.
sourcepub fn nearly_eq(self, other: Vector) -> bool
pub fn nearly_eq(self, other: Vector) -> bool
Returns true if this vector is approximately equal to other using a standard single precision epsilon value.
sourcepub fn nearly_eq_by(self, other: Vector, epsilon: f32) -> bool
pub fn nearly_eq_by(self, other: Vector, epsilon: f32) -> bool
Returns true if this vector is approximately equal to other using the specified epsilon value.
Trait Implementations§
source§impl PartialEq for Vector
impl PartialEq for Vector
impl Copy for Vector
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnwindSafe for Vector
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