#[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: f32The x component of the vector.
y: f32The y component of the vector.
z: f32The 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<'__de, __Context> BorrowDecode<'__de, __Context> for Vec3
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Vec3
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<'de> Deserialize<'de> for Vec3
impl<'de> Deserialize<'de> for Vec3
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Mul<Vec3> for Quaternion
impl Mul<Vec3> for Quaternion
impl Copy for Vec3
impl Pod 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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.