Struct ami::Vec3
[−]
[src]
pub struct Vec3<T: Copy + Clone> { pub x: T, pub y: T, pub z: T, }
3-dimensional vector
Fields
x: T
X coordinate
y: T
Y coordinate
z: T
Z coordinate
Methods
impl<T> Vec3<T> where
T: Copy + Clone,
[src]
T: Copy + Clone,
pub fn new(x: T, y: T, z: T) -> Vec3<T>
[src]
Create a new Vec3
pub fn mag(self) -> f32 where
Self: Into<Vec3<f32>>,
[src]
Self: Into<Vec3<f32>>,
Get the magnitude of a Vec3
impl Vec3<f32>
[src]
pub fn transform_dir(self, rhs: Mat4) -> Self
[src]
Multiply matrix onto Vec3 (as directional vector)
pub fn zero() -> Self
[src]
Create a zero Vec3
pub fn midpoint(self, other: Self) -> Self
[src]
Find the midpoint between two Vec3
pub fn dist_sq(self, other: Self) -> f32
[src]
Calculate the distance squared between two Vec3
pub fn recip(self) -> Self
[src]
The recipricol (inverse) of the vector.
pub fn dot(&self, other: Vec3<f32>) -> f32
[src]
Calculate the dot product of two Vec3
s
pub fn normalize(self) -> Self
[src]
Normalize a Vec3
pub fn angle(&self, other: Vec3<f32>) -> f32
[src]
Calculate angle between 2 Vec3's
Trait Implementations
impl Mul<Vec3<f32>> for Mat4
[src]
type Output = Vec3<f32>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec3<f32>) -> Self::Output
[src]
Transform as a position.
impl<T: Clone + Copy + Clone> Clone for Vec3<T>
[src]
fn clone(&self) -> Vec3<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Copy + Copy + Clone> Copy for Vec3<T>
[src]
impl<T: PartialEq + Copy + Clone> PartialEq for Vec3<T>
[src]
fn eq(&self, __arg_0: &Vec3<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vec3<T>) -> bool
[src]
This method tests for !=
.
impl<T> Debug for Vec3<T> where
T: Debug + Copy + Clone,
[src]
T: Debug + Copy + Clone,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T> Add for Vec3<T> where
T: Add<Output = T> + Copy + Clone,
[src]
T: Add<Output = T> + Copy + Clone,
type Output = Vec3<T>
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
Performs the +
operation.
impl<T> Sub for Vec3<T> where
T: Sub<Output = T> + Copy + Clone,
[src]
T: Sub<Output = T> + Copy + Clone,
type Output = Vec3<T>
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self::Output
[src]
Performs the -
operation.
impl<T> Mul<T> for Vec3<T> where
T: Mul<Output = T> + Copy + Clone,
[src]
T: Mul<Output = T> + Copy + Clone,
type Output = Vec3<T>
The resulting type after applying the *
operator.
fn mul(self, s: T) -> Self::Output
[src]
Performs the *
operation.
impl<T> Div<T> for Vec3<T> where
T: Div<Output = T> + Copy + Clone,
[src]
T: Div<Output = T> + Copy + Clone,
type Output = Vec3<T>
The resulting type after applying the /
operator.
fn div(self, s: T) -> Vec3<T>
[src]
Performs the /
operation.
impl<T> Neg for Vec3<T> where
T: Neg<Output = T> + Copy + Clone,
[src]
T: Neg<Output = T> + Copy + Clone,
type Output = Vec3<T>
The resulting type after applying the -
operator.
fn neg(self) -> Vec3<T>
[src]
Performs the unary -
operation.