Struct matriarch::Vec3 [−][src]
A 3D vector with elements x, y, and z
Fields
x: f32
y: f32
z: f32
Methods
impl Vec3
[src]
impl Vec3
pub fn new() -> Vec3
[src]
pub fn new() -> Vec3
Returns a new Vec3 at [0, 0, 0].
Example:
let vec3 = Vec3::new();
pub fn new_from_values(x: &f32, y: &f32, z: &f32) -> Vec3
[src]
pub fn new_from_values(x: &f32, y: &f32, z: &f32) -> Vec3
Returns a new Vec3 using the given values for x, y, and z.
Example:
let x: f32 = 1.0; let y: f32 = 2.0; let z: f32 = 3.0; let vec3 = Vec3::new_from_values(&x, &y, &z);
pub fn new_from_array(input: &[f32; 3]) -> Vec3
[src]
pub fn new_from_array(input: &[f32; 3]) -> Vec3
Returns a new Vec3 using the 0, 1, and 2 indices of the given array, where [0] -> x, [1] -> y, and [2] -> z.
Example:
let input = [ 1.0, 2.0, 3.0 ]; let vec3 = Vec3::new_from_array(&input);
pub fn to_array(&self) -> [f32; 3]
[src]
pub fn to_array(&self) -> [f32; 3]
Returns an array of the Vec3's x, y and z values where x -> [0], y -> [1], and z -> [2].
Example:
let array = some_vec3.to_array();
pub fn cross_product(&self, other_vec3: &Vec3) -> Vec3
[src]
pub fn cross_product(&self, other_vec3: &Vec3) -> Vec3
Returns the cross product of 2 Vec3s as a Vec3.
The cross product of 2 Vec3s is defined as a Vec3 that is perpendicular to both Vec3s.
Example:
let cross_product = some_vec3.cross_product(&some_other_vec3);
pub fn length(&self) -> f32
[src]
pub fn length(&self) -> f32
Returns the length of the Vec3.
Trait Implementations
impl Mul<Vec3> for Mat3
[src]
impl Mul<Vec3> for Mat3
type Output = Vec3
The resulting type after applying the *
operator.
fn mul(self, vec3: Vec3) -> Vec3
[src]
fn mul(self, vec3: Vec3) -> Vec3
Performs the *
operation.
impl Clone for Vec3
[src]
impl Clone for Vec3
fn clone(&self) -> Vec3
[src]
fn clone(&self) -> Vec3
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Vec3
[src]
impl Copy for Vec3
impl Debug for Vec3
[src]
impl Debug for Vec3
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for Vec3
[src]
impl Default for Vec3
impl PartialEq for Vec3
[src]
impl PartialEq for Vec3
fn eq(&self, other: &Vec3) -> bool
[src]
fn eq(&self, other: &Vec3) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vec3) -> bool
[src]
fn ne(&self, other: &Vec3) -> bool
This method tests for !=
.
impl Add<Vec3> for Vec3
[src]
impl Add<Vec3> for Vec3
type Output = Vec3
The resulting type after applying the +
operator.
fn add(self, other_vec3: Vec3) -> Vec3
[src]
fn add(self, other_vec3: Vec3) -> Vec3
Adds one Vec3 to another Vec3 and returns a new Vec3.
Example:
let vec3 = some_vec3 + some_other_vec3;
impl AddAssign for Vec3
[src]
impl AddAssign for Vec3
fn add_assign(&mut self, other_vec3: Vec3)
[src]
fn add_assign(&mut self, other_vec3: Vec3)
Adds one Vec3 to another Vec3 and re-assigns the first Vec3 to the new Vec3
Example:
some_vec3 += some_other_vec3;
impl Mul<Vec3> for f32
[src]
impl Mul<Vec3> for f32
type Output = Vec3
The resulting type after applying the *
operator.
fn mul(self, other_vec3: Vec3) -> Vec3
[src]
fn mul(self, other_vec3: Vec3) -> Vec3
Multiplies a scalar value by a Vec3 and returns a Vec3.
Example:
let scaled_vec3: Vec3 = some_scalar * some_vec3;
impl Mul<Vec3> for Vec3
[src]
impl Mul<Vec3> for Vec3
type Output = f32
The resulting type after applying the *
operator.
fn mul(self, other_vec3: Vec3) -> f32
[src]
fn mul(self, other_vec3: Vec3) -> f32
Retuns the dot product of 2 Vec3s, which is a scalar floating point.
Example:
let scalar: f32 = some_vec3 * some_other_vec3;
impl Neg for Vec3
[src]
impl Neg for Vec3
type Output = Vec3
The resulting type after applying the -
operator.
fn neg(self) -> Vec3
[src]
fn neg(self) -> Vec3
Negates the values of Vec3, which in turn negates the Vec3.
impl Sub<Vec3> for Vec3
[src]
impl Sub<Vec3> for Vec3
type Output = Vec3
The resulting type after applying the -
operator.
fn sub(self, other_vec3: Vec3) -> Vec3
[src]
fn sub(self, other_vec3: Vec3) -> Vec3
Subtracts one Vec3 from another Vec3 and returns a new Vec3.
Example:
let vec3 = some_vec3 - some_other_vec3;
impl SubAssign for Vec3
[src]
impl SubAssign for Vec3
fn sub_assign(&mut self, other_vec3: Vec3)
[src]
fn sub_assign(&mut self, other_vec3: Vec3)
Subtracts one Vec3 from another Vec3 and re-assigns the first Vec3 to the new Vec3.
Example:
some_vec3 -= some_other_vec3;