Struct dumbmath::vec3f::Vec3f
[−]
[src]
pub struct Vec3f { pub x: f32, pub y: f32, pub z: f32, }
Vector with three f32 components
Fields
x: f32
y: f32
z: f32
Methods
impl Vec3f
[src]
fn new(x: f32, y: f32, z: f32) -> Vec3f
Create a Vec3f from three components
fn from_scalar<T: CastF32>(s: T) -> Vec3f
Create a Vec3f with all components set to the same scalar
fn dot(self, v: Vec3f) -> f32
Inner product
fn cross(self, v: Vec3f) -> Vec3f
Cross product
fn distance(self, v: Vec3f) -> f32
Distance to another point
fn lerp(self, p: Vec3f, t: f32) -> Vec3f
Linearly interpolate between two points by the factor
t
. When t
is zero the result is self
, and when t
is
one the result is p
. The range of t
is not clamped.
fn magnitude_squared(self) -> f32
Squared length of the vector
fn magnitude(self) -> f32
Length of the vector
fn normalized(self) -> Option<Vec3f>
Create a normalized copy, or None if the magnitude is zero
fn project_onto(self, v: Vec3f) -> Option<Vec3f>
Projection of self
into v
, or None if the magnitude of
b
is zero.
Trait Implementations
impl Clone for Vec3f
[src]
fn clone(&self) -> Vec3f
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Vec3f
[src]
impl Debug for Vec3f
[src]
impl PartialEq for Vec3f
[src]
fn eq(&self, __arg_0: &Vec3f) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vec3f) -> bool
This method tests for !=
.
impl Add for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the +
operator
fn add(self, v: Vec3f) -> Vec3f
The method for the +
operator
impl Add<f32> for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the +
operator
fn add(self, s: f32) -> Vec3f
The method for the +
operator
impl Div for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the /
operator
fn div(self, v: Vec3f) -> Vec3f
The method for the /
operator
impl Mul<Vec3f> for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the *
operator
fn mul(self, v: Vec3f) -> Vec3f
The method for the *
operator
impl Mul<f32> for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the *
operator
fn mul(self, f: f32) -> Vec3f
The method for the *
operator
impl Sub for Vec3f
[src]
type Output = Vec3f
The resulting type after applying the -
operator
fn sub(self, v: Vec3f) -> Vec3f
The method for the -
operator