[−][src]Struct ico_math::Vector3
A vector of 3 floats (x,y,z).
Fields
data: __m128
Methods
impl Vector3
[src]
pub fn new(x: f32, y: f32, z: f32) -> Vector3
[src]
Construct a new vector from f32 components.
Examples
use ico_math::Vector3; let one_two_three = Vector3::new(1.0, 2.0, 3.0);
pub fn set<T: Into<FloatVector>>(value: T) -> Vector3
[src]
Set all values of the vector to the same f32 value.
Examples
use ico_math::Vector3; let ones = Vector3::set(1.0);
pub fn zero() -> Vector3
[src]
pub fn x(self) -> FloatVector
[src]
Get the x value of the vector, broadcast to all components as a FloatVector (xxxx).
Examples
use ico_math::Vector3; let one_two_three = Vector3::new(1.0, 2.0, 3.0); let one = one_two_three.x();
pub fn y(self) -> FloatVector
[src]
Get the y value of the vector, broadcast to all components as a FloatVector (yyyy).
Examples
use ico_math::Vector3; let one_two_three = Vector3::new(1.0, 2.0, 3.0); let two = one_two_three.y();
pub fn z(self) -> FloatVector
[src]
Get the z value of the vector, broadcast to all components as a FloatVector (zzzz).
Examples
use ico_math::Vector3; let one_two_three = Vector3::new(1.0, 2.0, 3.0); let three = one_two_three.z();
pub fn load(raw: &RawVector_f32) -> Vector3
[src]
Load a value from aligned memory.
Examples
use ico_math::Vector3; use ico_math::raw::RawVector_f32; let raw = RawVector_f32{data:[0.0,1.0,2.0,0.0]}; let one_two_three = Vector3::load(&raw);
pub fn store(self, dst: &mut RawVector_f32)
[src]
Store a value to aligned memory.
Examples
use ico_math::Vector3; use ico_math::raw::RawVector_f32; let mut raw = RawVector_f32{data:[0.0; 4]}; let one_two_three = Vector3::new(1.0, 2.0, 3.0); one_two_three.store(&mut raw);
pub fn set_x<T: Into<FloatVector>>(&mut self, value: T)
[src]
Set the x value of this vector, leaving the other components unchanged.
Examples
use ico_math::Vector3; let mut one_two_three = Vector3::new(1.0, 2.0, 3.0); one_two_three.set_x(0.5);
pub fn set_y<T: Into<FloatVector>>(&mut self, value: T)
[src]
Set the y value of this vector, leaving the other components unchanged.
Examples
use ico_math::Vector3; let mut one_two_three = Vector3::new(1.0, 2.0, 3.0); one_two_three.set_y(0.5);
pub fn set_z<T: Into<FloatVector>>(&mut self, value: T)
[src]
Set the z value of this vector, leaving the other components unchanged. This doesn't modify W.
Examples
use ico_math::Vector3; let mut one_two_three = Vector3::new(1.0, 2.0, 3.0); one_two_three.set_z(0.5);
pub fn dot(self, v2: Vector3) -> FloatVector
[src]
Compute the 3 element dot-product, and return it as a broadcast FloatVector.
pub fn cross(self, rhs: Vector3) -> Vector3
[src]
Right handed cross product.
pub fn add(self, v2: Vector3) -> Vector3
[src]
Compute the sum of two vectors and return it as a new vector.
pub fn sub(self, v2: Vector3) -> Vector3
[src]
Subtract a vector and return it as a new vector.
pub fn mul(self, v2: Vector3) -> Vector3
[src]
Multiply two vectors component-wise, and return it as a new vector.
(x1 * x2, y1 * y2, z1 * z2, w1 * w2)
pub fn div(self, v2: Vector3) -> Vector3
[src]
Divide two vectors component-wise, and return it as a new vector.
(x1 / x2, y1 / y2, z1 / z2, w1 / w2)
pub fn mul_add(self, v2: Vector3, v3: Vector3) -> Vector3
[src]
Fused Multiply Add. Result = (a * b) + c.
pub fn mul_sub(self, v2: Vector3, v3: Vector3) -> Vector3
[src]
Fused Multiply Sub. Result = (a * b) - c.
pub fn neg_mul_add(self, v2: Vector3, v3: Vector3) -> Vector3
[src]
Negated Fused Multiply Add. Result = -(a * b) + c.
pub fn neg_mul_sub(self, v2: Vector3, v3: Vector3) -> Vector3
[src]
Negated Fused Multiply Sub. Result = -(a * b) - c.
pub fn and<T: SIMDVector3>(self, v2: T) -> Vector3
[src]
Compute the bitwise AND of two vectors. This function treats inputs as binary data, and doesn't perform any conversions.
pub fn or<T: SIMDVector3>(self, v2: T) -> Vector3
[src]
Compute the bitwise OR of two vectors. This function treats inputs as binary data, and doesn't perform any conversions.
pub fn andnot<T: SIMDVector3>(self, v2: T) -> Vector3
[src]
Compute the bitwise ANDNOT of two vectors. This function treats inputs as binary data, and doesn't perform any conversions.
pub fn xor<T: SIMDVector3>(self, v2: T) -> Vector3
[src]
Compute the bitwise XOR of two vectors. This function treats inputs as binary data, and doesn't perform any conversions.
pub fn equal(self, v2: Vector3) -> Vector3Bool
[src]
Equals, computed component-wise. This compares bits, and is exact.
pub fn not_equal(self, v2: Vector3) -> Vector3Bool
[src]
NotEquals, computed component-wise. This compares bits, and is exact.
pub fn greater_equal(self, v2: Vector3) -> Vector3Bool
[src]
Greater than or equal to, computed component-wise. This compares bits, and is exact.
pub fn greater(self, v2: Vector3) -> Vector3Bool
[src]
Greater than, computed component-wise. This compares bits, and is exact.
pub fn less_equal(self, v2: Vector3) -> Vector3Bool
[src]
Less than or equal to, computed component-wise. This compares bits, and is exact.
pub fn less(self, v2: Vector3) -> Vector3Bool
[src]
Less than, computed component-wise. This compares bits, and is exact.
pub fn approx_equal(self, v2: Vector3) -> Vector3Bool
[src]
Relative and absolute epsilon comparison.
Uses machine epsilon as absolute, and 4*machine epsilon for relative.
return abs(a - b) <= max(machine_epsilon, (max( abs(a), abs(b) ) * relative_epsilon);
Adapted from Knuth.
https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
pub fn definitely_greater(self, v2: Vector3) -> Vector3Bool
[src]
Adapted from Knuth with an added absolute epsilon return (a - b) > max(machine_epsilon, (max( abs(a), abs(b) ) * relative_epsilon);
pub fn definitely_less(self, v2: Vector3) -> Vector3Bool
[src]
Adapted from Knuth with an added absolute epsilon return (a - b) > max(machine_epsilon, (max( abs(a), abs(b) ) * relative_epsilon);
pub fn abs(self) -> Vector3
[src]
The absolute value of each component of the vector.
pub fn copysign(self, v2: Vector3) -> Vector3
[src]
Take the magnitude of the first argument (self), and use the sign of the second argument to produce a new vector
pub fn floor(self) -> Vector3
[src]
Floor function. Returns signed 0 when applicable.
pub fn ceil(self) -> Vector3
[src]
Ceil function. Returns signed 0 when applicable.
pub fn round(self) -> Vector3
[src]
Round to nearest even function. Returns signed 0 when applicable.
pub fn truncate(self) -> Vector3
[src]
Truncate function.
pub fn floor_to_int(self) -> Vector3Int
[src]
Convert to an integer vector using the floor function.
pub fn ceil_to_int(self) -> Vector3Int
[src]
Convert to an integer vector using the ceil function.
pub fn round_to_int(self) -> Vector3Int
[src]
Convert to an integer vector using the round function.
pub fn truncate_to_int(self) -> Vector3Int
[src]
Convert to an integer vector using the truncate function.
pub fn frac(self) -> Vector3
[src]
Compute the fractional component of each component Result = X - Floor(x)
pub fn sqrt(self) -> Vector3
[src]
Compute the square root of each component
pub fn sin(self) -> Vector3
[src]
Compute the approximate sin of each component
pub fn cos(self) -> Vector3
[src]
Compute the approximate cos of each component
pub fn tan(self) -> Vector3
[src]
Compute the approximate tan of each component
pub fn acos(self) -> Vector3
[src]
Compute the approximate acos of each component
pub fn asin(self) -> Vector3
[src]
Compute the approximate asin of each component
pub fn atan2(self, x: Vector3) -> Vector3
[src]
pub fn max(self, v2: Vector3) -> Vector3
[src]
Compute the component-wise max.
pub fn min(self, v2: Vector3) -> Vector3
[src]
Compute the component-wise min.
pub fn horizontal_min(self) -> FloatVector
[src]
pub fn horizontal_max(self) -> FloatVector
[src]
pub fn select(self, v2: Vector3, mask: Vector3Bool) -> Vector3
[src]
Choose component wise between A and B based on the mask. False = A, True = B.
pub fn lerp<T: Into<FloatVector>>(self, v2: Vector3, t: T) -> Vector3
[src]
Linear interpolate from a to b based on a float.
pub fn normalize(self) -> Vector3
[src]
Normalize the vector. Returns a zero vector if the result would be infinity or NAN.
pub fn normalize_length(self) -> (Vector3, FloatVector)
[src]
Normalize the vector. Returns a zero vector if the result would be infinity or NAN. Also returns the length of the vector prior to normalization.
pub fn sqr_magnitude(self) -> FloatVector
[src]
The square magnitude of the vector. Equal to Dot(self, self).
pub fn magnitude(self) -> FloatVector
[src]
The magnitude of the vector. Equal to Sqrt(Dot(self, self)).
pub fn xxxx(self) -> Vector4
[src]
pub fn yyyy(self) -> Vector4
[src]
pub fn zzzz(self) -> Vector4
[src]
pub fn xxx(self) -> Vector3
[src]
pub fn xxy(self) -> Vector3
[src]
pub fn xxz(self) -> Vector3
[src]
pub fn xyx(self) -> Vector3
[src]
pub fn xyy(self) -> Vector3
[src]
pub fn xyz(self) -> Vector3
[src]
pub fn xzx(self) -> Vector3
[src]
pub fn xzy(self) -> Vector3
[src]
pub fn xzz(self) -> Vector3
[src]
pub fn yxx(self) -> Vector3
[src]
pub fn yxy(self) -> Vector3
[src]
pub fn yxz(self) -> Vector3
[src]
pub fn yyx(self) -> Vector3
[src]
pub fn yyy(self) -> Vector3
[src]
pub fn yyz(self) -> Vector3
[src]
pub fn yzx(self) -> Vector3
[src]
pub fn yzy(self) -> Vector3
[src]
pub fn yzz(self) -> Vector3
[src]
pub fn zxx(self) -> Vector3
[src]
pub fn zxy(self) -> Vector3
[src]
pub fn zxz(self) -> Vector3
[src]
pub fn zyx(self) -> Vector3
[src]
pub fn zyy(self) -> Vector3
[src]
pub fn zyz(self) -> Vector3
[src]
pub fn zzx(self) -> Vector3
[src]
pub fn zzy(self) -> Vector3
[src]
pub fn zzz(self) -> Vector3
[src]
Trait Implementations
impl SIMDVector3 for Vector3
[src]
impl Clone for Vector3
[src]
fn clone(&self) -> Vector3
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<Vector3> for Vector2
[src]
impl From<f32> for Vector3
[src]
impl From<FloatVector> for Vector3
[src]
fn from(v: FloatVector) -> Vector3
[src]
impl From<Vector2> for Vector3
[src]
impl From<Vector4> for Vector3
[src]
impl From<Vector3Int> for Vector3
[src]
fn from(v: Vector3Int) -> Vector3
[src]
impl From<Vector3> for Vector3Int
[src]
fn from(v: Vector3) -> Vector3Int
[src]
impl From<Vector3> for Vector4
[src]
impl PartialEq<Vector3> for Vector3
[src]
fn eq(&self, other: &Vector3) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Copy for Vector3
[src]
impl Debug for Vector3
[src]
impl<T: Into<FloatVector>> Div<T> for Vector3
[src]
type Output = Vector3
The resulting type after applying the /
operator.
fn div(self, _rhs: T) -> Vector3
[src]
impl Div<Vector3> for FloatVector
[src]
type Output = Vector3
The resulting type after applying the /
operator.
fn div(self: FloatVector, _rhs: Vector3) -> Vector3
[src]
impl Add<Vector3> for Vector3
[src]
type Output = Vector3
The resulting type after applying the +
operator.
fn add(self, _rhs: Vector3) -> Vector3
[src]
impl Sub<Vector3> for Vector3
[src]
type Output = Vector3
The resulting type after applying the -
operator.
fn sub(self, _rhs: Vector3) -> Vector3
[src]
impl Mul<Vector3> for Quaternion
[src]
type Output = Vector3
The resulting type after applying the *
operator.
fn mul(self, _rhs: Vector3) -> Vector3
[src]
impl<T: Into<FloatVector>> Mul<T> for Vector3
[src]
type Output = Vector3
The resulting type after applying the *
operator.
fn mul(self, _rhs: T) -> Vector3
[src]
impl Mul<Vector3> for FloatVector
[src]
type Output = Vector3
The resulting type after applying the *
operator.
fn mul(self: FloatVector, _rhs: Vector3) -> Vector3
[src]
impl Neg for Vector3
[src]
type Output = Vector3
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl AddAssign<Vector3> for Vector3
[src]
fn add_assign(&mut self, other: Vector3)
[src]
impl SubAssign<Vector3> for Vector3
[src]
fn sub_assign(&mut self, other: Vector3)
[src]
impl<T: Into<FloatVector>> MulAssign<T> for Vector3
[src]
fn mul_assign(&mut self, _rhs: T)
[src]
impl<T: Into<FloatVector>> DivAssign<T> for Vector3
[src]
fn div_assign(&mut self, _rhs: T)
[src]
Auto Trait Implementations
impl Sync for Vector3
impl Send for Vector3
impl Unpin for Vector3
impl RefUnwindSafe for Vector3
impl UnwindSafe for Vector3
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,