Struct matriarch::Vec3[][src]

pub struct Vec3 {
    pub x: f32,
    pub y: f32,
    pub z: f32,
}

A 3D vector with elements x, y, and z

Fields

Methods

impl Vec3
[src]

Returns a new Vec3 at [0, 0, 0].

Example:

let vec3 = Vec3::new();

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);

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);

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();

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);

Returns the length of the Vec3.

Trait Implementations

impl Mul<Vec3> for Mat3
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl Clone for Vec3
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Vec3
[src]

impl Debug for Vec3
[src]

Formats the value using the given formatter. Read more

impl Default for Vec3
[src]

Returns the "default value" for a type. Read more

impl PartialEq for Vec3
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Add<Vec3> for Vec3
[src]

The resulting type after applying the + operator.

Adds one Vec3 to another Vec3 and returns a new Vec3.

Example:

let vec3 = some_vec3 + some_other_vec3;

impl AddAssign for Vec3
[src]

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]

The resulting type after applying the * operator.

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]

The resulting type after applying the * operator.

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]

The resulting type after applying the - operator.

Negates the values of Vec3, which in turn negates the Vec3.

impl Sub<Vec3> for Vec3
[src]

The resulting type after applying the - operator.

Subtracts one Vec3 from another Vec3 and returns a new Vec3.

Example:

let vec3 = some_vec3 - some_other_vec3;

impl SubAssign for Vec3
[src]

Subtracts one Vec3 from another Vec3 and re-assigns the first Vec3 to the new Vec3.

Example:

some_vec3 -= some_other_vec3;

Auto Trait Implementations

impl Send for Vec3

impl Sync for Vec3