use crate::prelude::*;
pub trait HasXYZ: HasXY {
fn new_3d(x: Self::Scalar, y: Self::Scalar, z: Self::Scalar) -> Self;
fn z(self) -> Self::Scalar;
fn z_mut(&mut self) -> &mut Self::Scalar;
fn set_z(&mut self, val: Self::Scalar);
}
pub trait GenericVector3:
HasXYZ
+ Copy
+ Approx
+ PartialEq
+ std::ops::AddAssign
+ std::ops::SubAssign
+ std::ops::Index<usize, Output = Self::Scalar>
+ std::ops::IndexMut<usize, Output = Self::Scalar>
+ std::ops::Neg<Output = Self>
+ std::ops::Add<Self, Output = Self>
+ std::ops::Sub<Self, Output = Self>
+ std::ops::Mul<Self::Scalar, Output = Self>
+ std::ops::Div<Self::Scalar, Output = Self>
+ Into<[Self::Scalar; 3]>
+ From<[Self::Scalar; 3]>
{
const ZERO: Self;
const ONE: Self;
type Affine: Affine3D<Vector3 = Self>;
type Aabb: Aabb3<Vector = Self>;
type Vector2: GenericVector2<Scalar = Self::Scalar, Vector3 = Self>;
fn new(x: Self::Scalar, y: Self::Scalar, z: Self::Scalar) -> Self;
fn splat(value: Self::Scalar) -> Self;
fn to_2d(self) -> Self::Vector2;
fn magnitude(self) -> Self::Scalar;
fn magnitude_sq(self) -> Self::Scalar;
fn dot(self, other: Self) -> Self::Scalar;
fn cross(self, rhs: Self) -> Self;
fn normalize(self) -> Self;
fn try_normalize(self, epsilon: Self::Scalar) -> Option<Self>;
fn distance(self, other: Self) -> Self::Scalar;
fn distance_sq(self, rhs: Self) -> Self::Scalar;
fn min(self, rhs: Self) -> Self;
fn max(self, rhs: Self) -> Self;
fn clamp(self, min: Self, max: Self) -> Self;
fn is_finite(self) -> bool;
}
pub trait SimdUpgradable: GenericVector3
where
Self::Simd: GenericVector3<Scalar = Self::Scalar>,
{
type Simd;
fn to_simd(self) -> Self::Simd;
fn from_simd(simd: Self::Simd) -> Self;
}