#[repr(C)]pub struct Vec3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
Expand description
A 3-dimensional vector with f32
components.
Fields§
§x: f32
The x component of the vector.
y: f32
The y component of the vector.
z: f32
The z component of the vector.
Implementations§
Source§impl Vec3
impl Vec3
Sourcepub const fn new(x: f32, y: f32, z: f32) -> Self
pub const fn new(x: f32, y: f32, z: f32) -> Self
Creates a new Vec3
with the specified components.
Sourcepub fn length_squared(&self) -> f32
pub fn length_squared(&self) -> f32
Calculates the squared length (magnitude) of the vector.
Sourcepub fn cross(&self, other: Self) -> Self
pub fn cross(&self, other: Self) -> Self
Computes the cross product of this vector and another.
Sourcepub fn distance_squared(&self, other: Self) -> f32
pub fn distance_squared(&self, other: Self) -> f32
Calculates the squared distance between this vector and another.
Sourcepub fn distance(&self, other: Self) -> f32
pub fn distance(&self, other: Self) -> f32
Calculates the distance between this vector and another.
Trait Implementations§
Source§impl Mul<Vec3> for Quaternion
impl Mul<Vec3> for Quaternion
impl Copy for Vec3
impl StructuralPartialEq 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