#[repr(C)]pub struct Vec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}Fields§
§x: f32§y: f32§z: f32Implementations§
Source§impl Vec3
impl Vec3
pub const ZERO: Vec3
pub const ONE: Vec3
pub const NEG_ONE: Vec3
pub const NAN: Vec3
pub const INFINITY: Vec3
pub const NEG_INFINITY: Vec3
pub const fn new(x: f32, y: f32, z: f32) -> Vec3
pub const fn splat(value: f32) -> Vec3
pub const fn from_array(values: [f32; 3]) -> Vec3
pub const fn to_array(self) -> [f32; 3]
pub fn from_slice(values: &[f32]) -> Vec3
pub fn write_to_slice(self, values: &mut [f32])
pub fn is_finite(self) -> bool
pub fn is_nan(self) -> bool
pub fn dot(self, rhs: Vec3) -> f32
pub fn length_squared(self) -> f32
pub fn length_recip(self) -> f32
pub fn distance(self, other: Vec3) -> f32
pub fn distance_squared(self, other: Vec3) -> f32
Sourcepub fn try_normalize(self) -> Option<Vec3>
pub fn try_normalize(self) -> Option<Vec3>
Normalizes every finite nonzero vector, including subnormal inputs.
pub fn normalize(self) -> Vec3
pub fn normalize_or_zero(self) -> Vec3
pub fn normalize_or(self, fallback: Vec3) -> Vec3
pub fn is_normalized(self) -> bool
pub fn min(self, rhs: Vec3) -> Vec3
pub fn max(self, rhs: Vec3) -> Vec3
pub fn min_element(self) -> f32
pub fn max_element(self) -> f32
pub fn element_sum(self) -> f32
pub fn element_product(self) -> f32
pub fn abs(self) -> Vec3
pub fn signum(self) -> Vec3
pub fn floor(self) -> Vec3
pub fn ceil(self) -> Vec3
pub fn round(self) -> Vec3
pub fn trunc(self) -> Vec3
pub fn fract(self) -> Vec3
pub fn recip(self) -> Vec3
pub fn sqrt(self) -> Vec3
pub fn powf(self, exponent: f32) -> Vec3
pub fn exp(self) -> Vec3
pub fn clamp(self, min: Vec3, max: Vec3) -> Vec3
pub fn clamp_length(self, min: f32, max: f32) -> Vec3
pub fn clamp_length_max(self, max: f32) -> Vec3
pub fn clamp_length_min(self, min: f32) -> Vec3
pub fn lerp(self, rhs: Vec3, t: f32) -> Vec3
pub fn mul_add(self, multiplier: Vec3, add: Vec3) -> Vec3
pub fn abs_diff_eq(self, rhs: Vec3, tolerance: f32) -> bool
pub fn cmpeq(self, rhs: Vec3) -> BVec3
pub fn cmpne(self, rhs: Vec3) -> BVec3
pub fn cmplt(self, rhs: Vec3) -> BVec3
pub fn cmple(self, rhs: Vec3) -> BVec3
pub fn cmpgt(self, rhs: Vec3) -> BVec3
pub fn cmpge(self, rhs: Vec3) -> BVec3
pub fn select(mask: BVec3, if_true: Vec3, if_false: Vec3) -> Vec3
pub fn project_onto(self, other: Vec3) -> Vec3
pub fn reject_from(self, other: Vec3) -> Vec3
pub fn project_onto_normalized(self, normal: Vec3) -> Vec3
pub fn reject_from_normalized(self, normal: Vec3) -> Vec3
Sourcepub fn reflect(self, normal: Vec3) -> Vec3
pub fn reflect(self, normal: Vec3) -> Vec3
Reflects an incident vector about a unit surface normal.
pub fn move_towards(self, rhs: Vec3, max_distance: f32) -> Vec3
Source§impl Vec3
impl Vec3
pub const X: Vec3
pub const Y: Vec3
pub const Z: Vec3
pub const NEG_X: Vec3
pub const NEG_Y: Vec3
pub const NEG_Z: Vec3
pub const AXES: [Vec3; 3]
pub const fn extend(self, w: f32) -> Vec4
pub const fn truncate(self) -> Vec2
pub fn cross(self, rhs: Vec3) -> Vec3
pub fn angle_between(self, rhs: Vec3) -> f32
pub fn any_orthogonal_vector(self) -> Vec3
pub fn any_orthonormal_vector(self) -> Vec3
pub const fn xy(self) -> Vec2
pub const fn xz(self) -> Vec2
pub const fn yz(self) -> Vec2
pub const fn yx(self) -> Vec2
pub const fn zx(self) -> Vec2
pub const fn zy(self) -> Vec2
pub const fn xyz(self) -> Vec3
pub const fn xzy(self) -> Vec3
pub const fn yxz(self) -> Vec3
pub const fn yzx(self) -> Vec3
pub const fn zxy(self) -> Vec3
pub const fn zyx(self) -> Vec3
Trait Implementations§
Source§impl AddAssign<f32> for Vec3
impl AddAssign<f32> for Vec3
Source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
Performs the
+= operation. Read moreSource§impl AddAssign for Vec3
impl AddAssign for Vec3
Source§fn add_assign(&mut self, rhs: Vec3)
fn add_assign(&mut self, rhs: Vec3)
Performs the
+= operation. Read moreSource§impl DivAssign<f32> for Vec3
impl DivAssign<f32> for Vec3
Source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moreSource§impl DivAssign for Vec3
impl DivAssign for Vec3
Source§fn div_assign(&mut self, rhs: Vec3)
fn div_assign(&mut self, rhs: Vec3)
Performs the
/= operation. Read moreSource§impl MulAssign<f32> for Vec3
impl MulAssign<f32> for Vec3
Source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moreSource§impl MulAssign for Vec3
impl MulAssign for Vec3
Source§fn mul_assign(&mut self, rhs: Vec3)
fn mul_assign(&mut self, rhs: Vec3)
Performs the
*= operation. Read moreSource§impl SubAssign<f32> for Vec3
impl SubAssign<f32> for Vec3
Source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
Performs the
-= operation. Read moreSource§impl SubAssign for Vec3
impl SubAssign for Vec3
Source§fn sub_assign(&mut self, rhs: Vec3)
fn sub_assign(&mut self, rhs: Vec3)
Performs the
-= operation. Read moreimpl Copy for Vec3
impl StructuralPartialEq for Vec3
impl Vec3Swizzles for Vec3
Auto Trait Implementations§
impl Freeze for Vec3
impl RefUnwindSafe for Vec3
impl Send for Vec3
impl Sync for Vec3
impl Unpin for Vec3
impl UnwindSafe for Vec3
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
Mutably borrows from an owned value. Read more