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§
impl Copy for Vector
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl Freeze for Vector
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)