pub struct Vec3Batch {
pub x: Vec<f64>,
pub y: Vec<f64>,
pub z: Vec<f64>,
}Expand description
Structure-of-Arrays layout for batch Vec3 operations.
Each component (x, y, z) is stored in a separate contiguous vector, enabling efficient SIMD-style batch processing.
Fields§
§x: Vec<f64>X components of all vectors in the batch.
y: Vec<f64>Y components of all vectors in the batch.
z: Vec<f64>Z components of all vectors in the batch.
Implementations§
Source§impl Vec3Batch
impl Vec3Batch
Sourcepub fn from_aos(positions: &[[f64; 3]]) -> Self
pub fn from_aos(positions: &[[f64; 3]]) -> Self
Convert an Array-of-Structures slice to Structure-of-Arrays layout.
Each element of positions is [x, y, z].
Sourcepub fn to_aos(&self) -> Result<Vec<[f64; 3]>, SimdMathError>
pub fn to_aos(&self) -> Result<Vec<[f64; 3]>, SimdMathError>
Convert back from SoA to AoS layout.
Returns an error if internal dimensions are inconsistent.
Sourcepub fn add(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
pub fn add(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
Element-wise addition of two batches.
§Errors
Returns SimdMathError::SizeMismatch if batch sizes differ.
Sourcepub fn sub(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
pub fn sub(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
Element-wise subtraction of two batches.
§Errors
Returns SimdMathError::SizeMismatch if batch sizes differ.
Sourcepub fn dot(&self, other: &Vec3Batch) -> Result<Vec<f64>, SimdMathError>
pub fn dot(&self, other: &Vec3Batch) -> Result<Vec<f64>, SimdMathError>
Batch dot product: returns x[i]*other.x[i] + y[i]*other.y[i] + z[i]*other.z[i]
for each i.
§Errors
Returns SimdMathError::SizeMismatch if batch sizes differ.
Sourcepub fn cross(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
pub fn cross(&self, other: &Vec3Batch) -> Result<Vec3Batch, SimdMathError>
Batch cross product.
For each index i, computes self[i] × other[i].
§Errors
Returns SimdMathError::SizeMismatch if batch sizes differ.
Sourcepub fn normalize(&mut self) -> Result<(), SimdMathError>
pub fn normalize(&mut self) -> Result<(), SimdMathError>
Normalize all vectors in-place to unit length.
Vectors with length below f64::EPSILON are left unchanged and their
indices are collected in the returned error. If all vectors are valid,
returns Ok(()).
§Errors
Returns SimdMathError::ZeroLengthVector for the first zero-length vector found.
Sourcepub fn distance_sq_pairwise(
a: &Vec3Batch,
b: &Vec3Batch,
) -> Result<Vec<f64>, SimdMathError>
pub fn distance_sq_pairwise( a: &Vec3Batch, b: &Vec3Batch, ) -> Result<Vec<f64>, SimdMathError>
Batch pairwise squared distance: |a[i] - b[i]|^2 for each i.
§Errors
Returns SimdMathError::SizeMismatch if batch sizes differ.
Trait Implementations§
impl StructuralPartialEq for Vec3Batch
Auto Trait Implementations§
impl Freeze for Vec3Batch
impl RefUnwindSafe for Vec3Batch
impl Send for Vec3Batch
impl Sync for Vec3Batch
impl Unpin for Vec3Batch
impl UnsafeUnpin for Vec3Batch
impl UnwindSafe for Vec3Batch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.