pub struct Float2 {
pub x: f32,
pub y: f32,
}Expand description
Vector containing 2 floating point values.
Fields§
§x: f32The x-component of the vector.
y: f32The y-component of the vector.
Implementations§
Source§impl Float2
impl Float2
Sourcepub fn acos(&self) -> Self
pub fn acos(&self) -> Self
Computes the per-component arccosine numbers (in radians). Each component should be a value within the range of -1 to 1. Return values are in the range 0, pi or NaN if the number is outside the range -1 to 1.
Sourcepub fn asin(&self) -> Self
pub fn asin(&self) -> Self
Computes the per-component arcsine numbers (in radians). Each component should be a value within the range of -1 to 1. Return values are in the range -pi/2 to pi/2 or NaN if the number is outside the range -1 to 1.
Sourcepub fn atan(&self) -> Self
pub fn atan(&self) -> Self
Computes the per-component arctangent numbers (in radians). Return values are in the range -pi/2 to pi/2.
Sourcepub fn ceil(&self) -> Self
pub fn ceil(&self) -> Self
Computes the per-component smallest integers greater than or equal to self.x and self.y respectively.
Sourcepub fn clamp(&self, min: f32, max: f32) -> Self
pub fn clamp(&self, min: f32, max: f32) -> Self
Computes the per-component clamped numbers between min and max.
Sourcepub fn floor(&self) -> Self
pub fn floor(&self) -> Self
Computes the per-component largest integers less than or equal to self.x and self.y respectively.
Sourcepub fn fmod(&self, rhs: &Self) -> Self
pub fn fmod(&self, rhs: &Self) -> Self
Computes the floating-point remainder of division for each component.
Sourcepub fn frac(&self) -> Self
pub fn frac(&self) -> Self
Computes the fractional (or decimal) part of each component; which is greater than or equal to 0 and less than 1.
Sourcepub fn ldexp(&self, exponent: &Self) -> Self
pub fn ldexp(&self, exponent: &Self) -> Self
Computes value * 2^exponent for each component of the vector.
Sourcepub fn lerp(&self, rhs: &Self, t: f32) -> Self
pub fn lerp(&self, rhs: &Self, t: f32) -> Self
Computes a linear interpolation between two vectors.
Sourcepub fn log(&self) -> Self
pub fn log(&self) -> Self
Computes the natural logarithm (base e) of each component of the vector.
Sourcepub fn log10(&self) -> Self
pub fn log10(&self) -> Self
Computes the natural logarithm (base 10) of each component of the vector.
Sourcepub fn log2(&self) -> Self
pub fn log2(&self) -> Self
Computes the natural logarithm (base 2) of each component of the vector.
Sourcepub fn mad(&self, b: &Self, c: &Self) -> Self
pub fn mad(&self, b: &Self, c: &Self) -> Self
Computes the multiply-add operation: (self * b) + c.
Sourcepub fn rcp(&self) -> Self
pub fn rcp(&self) -> Self
Computes the reciprocal of each component of the vector.
Equivalent to 1 / self.
Sourcepub fn rcp_safe(&self) -> Self
pub fn rcp_safe(&self) -> Self
Computes the reciprocal of each component of the vector.
Equivalent to 1 / self and returning 0 when self is 0.
Sourcepub fn reflect(&self, normal: &Self) -> Self
pub fn reflect(&self, normal: &Self) -> Self
Computes the reflection of an incident vector self about a normal vector normal.
Sourcepub fn refract(&self, normal: &Self, eta: f32) -> Self
pub fn refract(&self, normal: &Self, eta: f32) -> Self
Computes the refraction vector for the given incident vector, normal, and refraction index.
Sourcepub fn rsqrt(&self) -> Self
pub fn rsqrt(&self) -> Self
Computes the reciprocal square root of each component of the vector.
Sourcepub fn smoothstep(&self, min: &Self, max: &Self) -> Self
pub fn smoothstep(&self, min: &Self, max: &Self) -> Self
Performs smoothstep interpolation on each component of the vector.
Trait Implementations§
Source§impl AddAssign<f32> for Float2
impl AddAssign<f32> for Float2
Source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
+= operation. Read moreSource§impl AddAssign for Float2
impl AddAssign for Float2
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl DivAssign<f32> for Float2
impl DivAssign<f32> for Float2
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
/= operation. Read moreSource§impl DivAssign for Float2
impl DivAssign for Float2
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/= operation. Read moreSource§impl MulAssign<f32> for Float2
impl MulAssign<f32> for Float2
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
*= operation. Read moreSource§impl MulAssign for Float2
impl MulAssign for Float2
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*= operation. Read moreSource§impl SubAssign<f32> for Float2
impl SubAssign<f32> for Float2
Source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
-= operation. Read moreSource§impl SubAssign for Float2
impl SubAssign for Float2
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more