pub type FVec4 = FVec<4>;Expand description
A 4-vector of f32s.
Aliased Type§
pub struct FVec4(/* private fields */);Implementations§
Source§impl FVec4
impl FVec4
Sourcepub fn w(self) -> f32
pub fn w(self) -> f32
The vector’s w component (also called r for the real component of ijk[r]).
Sourcepub fn from_raw(raw: C3D_FVec) -> Self
pub fn from_raw(raw: C3D_FVec) -> Self
Wrap a raw citro3d_sys::C3D_FVec
Sourcepub fn perspective_divide(self) -> Self
pub fn perspective_divide(self) -> Self
Divide the vector’s XYZ components by its W component.
§Example
let v = FVec4::new(2.0, 4.0, 6.0, 2.0);
assert_abs_diff_eq!(v.perspective_divide(), FVec4::new(1.0, 2.0, 3.0, 1.0));Sourcepub fn dot(self, rhs: Self) -> f32
pub fn dot(self, rhs: Self) -> f32
The dot product of two vectors.
§Example
let v1 = FVec4::new(1.0, 2.0, 3.0, 4.0);
let v2 = FVec4::new(1.0, 0.5, 1.0, 0.5);
assert_abs_diff_eq!(v1.dot(v2), 7.0);