Struct slender_math::Vector2f
source · #[repr(C, align(8))]pub struct Vector2f(_);Expand description
A vector with 2 f32 components
Implementations§
source§impl Vector2f
impl Vector2f
sourcepub const fn from_scalar(scalar: f32) -> Self
pub const fn from_scalar(scalar: f32) -> Self
Creates a new vector by setting all components to the given scalar
sourcepub const fn from_array(array: [f32; 2]) -> Self
pub const fn from_array(array: [f32; 2]) -> Self
Creates a new vector from the given array
sourcepub fn as_mut_array(&mut self) -> &mut [f32; 2]
pub fn as_mut_array(&mut self) -> &mut [f32; 2]
Returns a mutable array reference to the vector
source§impl Vector2f
impl Vector2f
sourcepub fn abs(self) -> Self
pub fn abs(self) -> Self
Returns a vector with each component set to the absolute value of the corresponding component in this vector
sourcepub fn recip(self) -> Self
pub fn recip(self) -> Self
Returns a vector with each component set to the reciprocal of the corresponding component in this vector
sourcepub fn floor(self) -> Self
pub fn floor(self) -> Self
Returns a vector with each component set to the floor of the corresponding component in this vector
sourcepub fn ceil(self) -> Self
pub fn ceil(self) -> Self
Returns a vector with each component set to the ceiling of the corresponding component in this vector
sourcepub fn fract(self) -> Self
pub fn fract(self) -> Self
Returns a vector with each component set to the fractional part of the corresponding component in this vector
sourcepub fn normalized(self) -> Self
pub fn normalized(self) -> Self
Normalizes the vector
sourcepub fn lerp(self, rhs: Self, t: f32) -> Self
pub fn lerp(self, rhs: Self, t: f32) -> Self
Linearily interpolates between this vector and rhs
sourcepub fn min(self, rhs: Self) -> Self
pub fn min(self, rhs: Self) -> Self
Returns a vector with each component set to the minimum of the corresponding components between this vector and rhs
§impl Vector2f
impl Vector2f
pub fn xx(&self) -> Vector2f
pub fn rr(&self) -> Vector2f
pub fn xy(&self) -> Vector2f
pub fn rg(&self) -> Vector2f
pub fn yx(&self) -> Vector2f
pub fn gr(&self) -> Vector2f
pub fn yy(&self) -> Vector2f
pub fn gg(&self) -> Vector2f
pub fn xxx(&self) -> Vector3f
pub fn rrr(&self) -> Vector3f
pub fn xxy(&self) -> Vector3f
pub fn rrg(&self) -> Vector3f
pub fn xyx(&self) -> Vector3f
pub fn rgr(&self) -> Vector3f
pub fn xyy(&self) -> Vector3f
pub fn rgg(&self) -> Vector3f
pub fn yxx(&self) -> Vector3f
pub fn grr(&self) -> Vector3f
pub fn yxy(&self) -> Vector3f
pub fn grg(&self) -> Vector3f
pub fn yyx(&self) -> Vector3f
pub fn ggr(&self) -> Vector3f
pub fn yyy(&self) -> Vector3f
pub fn ggg(&self) -> Vector3f
pub fn xxxx(&self) -> Vector4f
pub fn rrrr(&self) -> Vector4f
pub fn xxxy(&self) -> Vector4f
pub fn rrrg(&self) -> Vector4f
pub fn xxyx(&self) -> Vector4f
pub fn rrgr(&self) -> Vector4f
pub fn xxyy(&self) -> Vector4f
pub fn rrgg(&self) -> Vector4f
pub fn xyxx(&self) -> Vector4f
pub fn rgrr(&self) -> Vector4f
pub fn xyxy(&self) -> Vector4f
pub fn rgrg(&self) -> Vector4f
pub fn xyyx(&self) -> Vector4f
pub fn rggr(&self) -> Vector4f
pub fn xyyy(&self) -> Vector4f
pub fn rggg(&self) -> Vector4f
pub fn yxxx(&self) -> Vector4f
pub fn grrr(&self) -> Vector4f
pub fn yxxy(&self) -> Vector4f
pub fn grrg(&self) -> Vector4f
pub fn yxyx(&self) -> Vector4f
pub fn grgr(&self) -> Vector4f
pub fn yxyy(&self) -> Vector4f
pub fn grgg(&self) -> Vector4f
pub fn yyxx(&self) -> Vector4f
pub fn ggrr(&self) -> Vector4f
pub fn yyxy(&self) -> Vector4f
pub fn ggrg(&self) -> Vector4f
pub fn yyyx(&self) -> Vector4f
pub fn gggr(&self) -> Vector4f
pub fn yyyy(&self) -> Vector4f
pub fn gggg(&self) -> Vector4f
Trait Implementations§
source§impl AddAssign<Vector2f> for Vector2f
impl AddAssign<Vector2f> for Vector2f
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moresource§impl AddAssign<f32> for Vector2f
impl AddAssign<f32> for Vector2f
source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
+= operation. Read moresource§impl DivAssign<Vector2f> for Vector2f
impl DivAssign<Vector2f> for Vector2f
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moresource§impl DivAssign<f32> for Vector2f
impl DivAssign<f32> for Vector2f
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moresource§impl MulAssign<Vector2f> for Vector2f
impl MulAssign<Vector2f> for Vector2f
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moresource§impl MulAssign<f32> for Vector2f
impl MulAssign<f32> for Vector2f
source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moresource§impl PartialEq<Vector2f> for Vector2f
impl PartialEq<Vector2f> for Vector2f
source§impl RemAssign<Vector2f> for Vector2f
impl RemAssign<Vector2f> for Vector2f
source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
%= operation. Read moresource§impl RemAssign<f32> for Vector2f
impl RemAssign<f32> for Vector2f
source§fn rem_assign(&mut self, rhs: f32)
fn rem_assign(&mut self, rhs: f32)
%= operation. Read moresource§impl SubAssign<Vector2f> for Vector2f
impl SubAssign<Vector2f> for Vector2f
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read moresource§impl SubAssign<f32> for Vector2f
impl SubAssign<f32> for Vector2f
source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
-= operation. Read moreimpl Copy for Vector2f
impl Pod for Vector2f
impl StructuralPartialEq for Vector2f
Auto Trait Implementations§
impl RefUnwindSafe for Vector2f
impl Send for Vector2f
impl Sync for Vector2f
impl Unpin for Vector2f
impl UnwindSafe for Vector2f
Blanket Implementations§
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.