#[repr(C)]pub struct Vec3x8 {
pub x: f32x8,
pub y: f32x8,
pub z: f32x8,
}Expand description
A set of three coordinates which may be interpreted as a point or vector in 3d space, or as a homogeneous 2d vector or point.
Generally this distinction between a point and vector is more of a pain than it is worth to distinguish on a type level, however when converting to and from homogeneous coordinates it is quite important.
Fields§
§x: f32x8§y: f32x8§z: f32x8Implementations§
Source§impl Vec3x8
impl Vec3x8
pub const fn new(x: f32x8, y: f32x8, z: f32x8) -> Vec3x8
pub const fn broadcast(val: f32x8) -> Vec3x8
pub fn unit_x() -> Vec3x8
pub fn unit_y() -> Vec3x8
pub fn unit_z() -> Vec3x8
Sourcepub fn into_homogeneous_point(self) -> Vec4x8
pub fn into_homogeneous_point(self) -> Vec4x8
Create a homogeneous 3d point from this vector interpreted as a point, meaning the homogeneous component will start with a value of 1.0.
Sourcepub fn into_homogeneous_vector(self) -> Vec4x8
pub fn into_homogeneous_vector(self) -> Vec4x8
Create a homogeneous 3d vector from this vector, meaning the homogeneous component will always have a value of 0.0.
Sourcepub fn from_homogeneous_point(v: Vec4x8) -> Vec3x8
pub fn from_homogeneous_point(v: Vec4x8) -> Vec3x8
Create a 3d point from a homogeneous 3d point, performing division by the homogeneous component. This should not be used for homogeneous 3d vectors, which will have 0 as their homogeneous component.
Sourcepub fn from_homogeneous_vector(v: Vec4x8) -> Vec3x8
pub fn from_homogeneous_vector(v: Vec4x8) -> Vec3x8
Create a 3d vector from homogeneous 2d vector, which simply discards the homogeneous component.
pub fn dot(&self, other: Vec3x8) -> f32x8
Sourcepub fn wedge(&self, other: Vec3x8) -> Bivec3x8
pub fn wedge(&self, other: Vec3x8) -> Bivec3x8
The wedge (aka exterior) product of two vectors.
This operation results in a bivector, which represents
the plane parallel to the two vectors, and which has a
‘oriented area’ equal to the parallelogram created by extending
the two vectors, oriented such that the positive direction is the
one which would move self closer to other.
Sourcepub fn geom(&self, other: Vec3x8) -> Rotor3x8
pub fn geom(&self, other: Vec3x8) -> Rotor3x8
The geometric product of this and another vector, which is defined as the sum of the dot product and the wedge product.
This operation results in a ‘rotor’, named as such as it may define
a rotation. The rotor which results from the geometric product
will rotate in the plane parallel to the two vectors, by twice the angle between
them and in the opposite direction (i.e. it will rotate in the direction that would
bring other towards self, and rotate in that direction by twice the angle between them).
pub fn rotate_by(&mut self, rotor: Rotor3x8)
pub fn rotated_by(self, rotor: Rotor3x8) -> Vec3x8
pub fn cross(&self, other: Vec3x8) -> Vec3x8
pub fn reflect(&mut self, normal: Vec3x8)
pub fn reflected(&self, normal: Vec3x8) -> Vec3x8
pub fn mag_sq(&self) -> f32x8
pub fn mag(&self) -> f32x8
pub fn normalize(&mut self)
pub fn normalized(&self) -> Vec3x8
Sourcepub fn normalize_homogeneous_point(&mut self)
pub fn normalize_homogeneous_point(&mut self)
Normalize self in-place by interpreting it as a homogeneous point, i.e.
scaling the vector to ensure the homogeneous component has length 1.
Sourcepub fn normalized_homogeneous_point(&self) -> Vec3x8
pub fn normalized_homogeneous_point(&self) -> Vec3x8
Normalize self by interpreting it as a homogeneous point, i.e.
scaling the vector to ensure the homogeneous component has length 1.
pub fn mul_add(&self, mul: Vec3x8, add: Vec3x8) -> Vec3x8
pub fn abs(&self) -> Vec3x8
pub fn clamp(&mut self, min: Vec3x8, max: Vec3x8)
pub fn clamped(self, min: Vec3x8, max: Vec3x8) -> Vec3x8
pub fn map<F>(&self, f: F) -> Vec3x8
pub fn apply<F>(&mut self, f: F)
pub fn max_by_component(self, other: Vec3x8) -> Vec3x8
pub fn min_by_component(self, other: Vec3x8) -> Vec3x8
pub fn component_max(&self) -> f32x8
pub fn component_min(&self) -> f32x8
pub fn zero() -> Vec3x8
pub fn one() -> Vec3x8
pub const fn xy(&self) -> Vec2x8
pub fn xyzw(&self) -> Vec4x8
Sourcepub fn layout() -> Layout
pub fn layout() -> Layout
Get the core::alloc::Layout of Self
Sourcepub fn as_array(&self) -> &[f32x8; 3]
pub fn as_array(&self) -> &[f32x8; 3]
Interpret self as a statically-sized array of its base numeric type
Sourcepub fn as_mut_array(&mut self) -> &mut [f32x8; 3]
pub fn as_mut_array(&mut self) -> &mut [f32x8; 3]
Interpret self as a statically-sized array of its base numeric type
Sourcepub fn as_mut_slice(&mut self) -> &mut [f32x8]
pub fn as_mut_slice(&mut self) -> &mut [f32x8]
Interpret self as a slice of its base numeric type
pub fn as_byte_slice(&self) -> &[u8] ⓘ
pub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
Sourcepub const fn as_ptr(&self) -> *const f32x8
pub const fn as_ptr(&self) -> *const f32x8
Returns a constant unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
§Safety
It is up to the caller to correctly use this pointer and its bounds.
Sourcepub fn as_mut_ptr(&mut self) -> *mut f32x8
pub fn as_mut_ptr(&mut self) -> *mut f32x8
Returns a mutable unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
§Safety
It is up to the caller to correctly use this pointer and its bounds.
Source§impl Vec3x8
impl Vec3x8
pub fn new_splat(x: f32, y: f32, z: f32) -> Vec3x8
pub fn splat(vec: Vec3) -> Vec3x8
Sourcepub fn blend(mask: f32x8, tru: Vec3x8, fals: Vec3x8) -> Vec3x8
pub fn blend(mask: f32x8, tru: Vec3x8, fals: Vec3x8) -> Vec3x8
Blend two vectors together lanewise using mask as a mask.
This is essentially a bitwise blend operation, such that any point where
there is a 1 bit in mask, the output will put the bit from tru, while
where there is a 0 bit in mask, the output will put the bit from fals
pub fn refract(&mut self, normal: Vec3x8, eta: f32x8)
pub fn refracted(&self, normal: Vec3x8, eta: f32x8) -> Vec3x8
Trait Implementations§
Source§impl AddAssign for Vec3x8
impl AddAssign for Vec3x8
Source§fn add_assign(&mut self, rhs: Vec3x8)
fn add_assign(&mut self, rhs: Vec3x8)
+= operation. Read moreSource§impl DivAssign<f32x8> for Vec3x8
impl DivAssign<f32x8> for Vec3x8
Source§fn div_assign(&mut self, rhs: f32x8)
fn div_assign(&mut self, rhs: f32x8)
/= operation. Read moreSource§impl DivAssign for Vec3x8
impl DivAssign for Vec3x8
Source§fn div_assign(&mut self, rhs: Vec3x8)
fn div_assign(&mut self, rhs: Vec3x8)
/= operation. Read moreSource§impl FloatVector for Vec3x8
impl FloatVector for Vec3x8
Source§impl Lerp<f32x8> for Vec3x8
impl Lerp<f32x8> for Vec3x8
Source§fn lerp(&self, end: Vec3x8, t: f32x8) -> Vec3x8
fn lerp(&self, end: Vec3x8, t: f32x8) -> Vec3x8
Linearly interpolate between self and end by t between 0.0 and 1.0.
i.e. (1.0 - t) * self + (t) * end.
For interpolating Rotors with linear interpolation, you almost certainly
want to normalize the returned Rotor. For example,
let interpolated_rotor = rotor1.lerp(rotor2, 0.5).normalized();For most cases (especially where performance is the primary concern, like in
animation interpolation for games, this ‘normalized lerp’ or ‘nlerp’ is probably
what you want to use. However, there are situations in which you really want
the interpolation between two Rotors to be of constant angular velocity. In this
case, check out Slerp.
Source§impl MulAssign<f32x8> for Vec3x8
impl MulAssign<f32x8> for Vec3x8
Source§fn mul_assign(&mut self, rhs: f32x8)
fn mul_assign(&mut self, rhs: f32x8)
*= operation. Read moreSource§impl MulAssign for Vec3x8
impl MulAssign for Vec3x8
Source§fn mul_assign(&mut self, rhs: Vec3x8)
fn mul_assign(&mut self, rhs: Vec3x8)
*= operation. Read moreSource§impl Reduce for Vec3x8
impl Reduce for Vec3x8
Source§fn reduce_sum(self) -> Self::Element
fn reduce_sum(self) -> Self::Element
Source§impl SIMD for Vec3x8
impl SIMD for Vec3x8
Source§impl Slerp<f32x8> for Vec3x8
impl Slerp<f32x8> for Vec3x8
Source§fn slerp(&self, end: Vec3x8, t: f32x8) -> Vec3x8
fn slerp(&self, end: Vec3x8, t: f32x8) -> Vec3x8
Spherical-linear interpolation between self and end based on t from 0.0 to 1.0.
self and end should both be normalized or something bad will happen!
The implementation for SIMD types also requires that the two things being interpolated between are not exactly aligned, or else the result is undefined.
Basically, interpolation that maintains a constant angular velocity
from one orientation on a unit hypersphere to another. This is sorta the “high quality” interpolation
for Rotors, and it can also be used to interpolate other things, one example being interpolation of
3d normal vectors.
Note that you should often normalize the result returned by this operation, when working with Rotors, etc!
Source§impl SubAssign for Vec3x8
impl SubAssign for Vec3x8
Source§fn sub_assign(&mut self, rhs: Vec3x8)
fn sub_assign(&mut self, rhs: Vec3x8)
-= operation. Read moreimpl Copy for Vec3x8
impl StructuralPartialEq for Vec3x8
Auto Trait Implementations§
impl Freeze for Vec3x8
impl RefUnwindSafe for Vec3x8
impl Send for Vec3x8
impl Sync for Vec3x8
impl Unpin for Vec3x8
impl UnwindSafe for Vec3x8
Blanket Implementations§
Source§impl<U> AsPrimitive for U
impl<U> AsPrimitive for U
Source§fn as_<F: FromPrimitive<Self>>(self) -> F
fn as_<F: FromPrimitive<Self>>(self) -> F
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more