pub type FVec3 = FVec<3>;Expand description
A 3-vector of f32s.
Aliased Type§
pub 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);