pub type FVec3 = FVec<3>;
Expand description
A 3-vector of f32
s.
Aliased Type§
struct FVec3(/* private fields */);
Implementations§
source§impl FVec3
impl FVec3
sourcepub fn distance(self, rhs: Self) -> f32
pub fn distance(self, rhs: Self) -> f32
The distance between two points in 3D space.
§Example
let l = FVec3::new(1.0, 3.0, 4.0);
let r = FVec3::new(0.0, 1.0, 2.0);
assert_abs_diff_eq!(l.distance(r), 3.0);
sourcepub fn cross(self, rhs: Self) -> Self
pub fn cross(self, rhs: Self) -> Self
The cross product of two 3D vectors.
§Example
let l = FVec3::new(1.0, 0.0, 0.0);
let r = FVec3::new(0.0, 1.0, 0.0);
assert_abs_diff_eq!(l.cross(r), FVec3::new(0.0, 0.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 l = FVec3::new(1.0, 2.0, 3.0);
let r = FVec3::new(3.0, 2.0, 1.0);
assert_abs_diff_eq!(l.dot(r), 10.0);