pub type FVec4 = FVec<4>;
Expand description
A 4-vector of f32
s.
Aliased Type§
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);