Struct crystal_ball::math::Vec4
source · pub struct Vec4 {
pub x: f64,
pub y: f64,
pub z: f64,
pub w: f64,
}
Expand description
A 4-dimensional vector.
Fields§
§x: f64
§y: f64
§z: f64
§w: f64
Implementations§
source§impl Vec4
impl Vec4
pub const X: Vec4 = _
pub const Y: Vec4 = _
pub const Z: Vec4 = _
pub const W: Vec4 = _
pub const ZERO: Vec4 = _
sourcepub fn random(rng: &mut TlsWyRand, min: f64, max: f64) -> Self
pub fn random(rng: &mut TlsWyRand, min: f64, max: f64) -> Self
Generate a Vec4 where each component is a uniform random number between min
and max
.
sourcepub fn magnitude_squared(&self) -> f64
pub fn magnitude_squared(&self) -> f64
Calculate the square of the vector’s magnitude (length).
Trait Implementations§
source§impl AddAssign for Vec4
impl AddAssign for Vec4
source§fn add_assign(&mut self, rhs: Vec4)
fn add_assign(&mut self, rhs: Vec4)
Performs the
+=
operation. Read moresource§impl DivAssign<f64> for Vec4
impl DivAssign<f64> for Vec4
source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/=
operation. Read moresource§impl MulAssign<f64> for Vec4
impl MulAssign<f64> for Vec4
source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*=
operation. Read moresource§impl PartialEq for Vec4
impl PartialEq for Vec4
source§impl SubAssign for Vec4
impl SubAssign for Vec4
source§fn sub_assign(&mut self, rhs: Vec4)
fn sub_assign(&mut self, rhs: Vec4)
Performs the
-=
operation. Read moreimpl Copy for Vec4
impl StructuralPartialEq for Vec4
Auto Trait Implementations§
impl RefUnwindSafe for Vec4
impl Send for Vec4
impl Sync for Vec4
impl Unpin for Vec4
impl UnwindSafe for Vec4
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> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.