# [−]Struct lumol::types::Vector3D

pub struct Vector3D(_);

A 3-dimensional vector type

A Vector3D implement all the arithmetic operations:

let u = Vector3D::new(1.0, 2.0, 3.0);
let v = Vector3D::new(4.0, -2.0, 1.0);

// Indexing
assert_eq!(u, 1.0);
assert_eq!(u, 2.0);
assert_eq!(u, 3.0);

let w = u + v;
assert_eq!(w, Vector3D::new(5.0, 0.0, 4.0));

// Subtraction
let w = u - v;
assert_eq!(w, Vector3D::new(-3.0, 4.0, 2.0));

// Negation
let w = -u;
assert_eq!(w, Vector3D::new(-1.0, -2.0, -3.0));

// Cross product
let w = u ^ v;
assert_eq!(w, Vector3D::new(8.0, 11.0, -10.0));

// Multiplication
let w = 2.0 * u;
assert_eq!(w, Vector3D::new(2.0, 4.0, 6.0));

let w = u * 3.0;
assert_eq!(w, Vector3D::new(3.0, 6.0, 9.0));

// Division
let w = u / 2.0;
assert_eq!(w, Vector3D::new(0.5, 1.0, 1.5));

// Dot product
let a = u * v;
assert_eq!(a, 3.0);

## Methods

### impl Vector3D

#### pub fn new(x: f64, y: f64, z: f64) -> Vector3D

Create a new Vector3D with components x, y, z

# Examples

let vector = Vector3D::new(1.0, 0.0, -42.0);

assert_eq!(vector, 1.0);
assert_eq!(vector, 0.0);
assert_eq!(vector, -42.0);

#### pub fn zero() -> Vector3D

Create a new Vector3D with components 0, 0, 0

# Examples

let vector = Vector3D::zero();
assert_eq!(vector, 0.0);
assert_eq!(vector, 0.0);
assert_eq!(vector, 0.0);

#### pub fn norm2(&self) -> f64

Return the squared euclidean norm of a Vector3D

# Examples

let vec = Vector3D::new(1.0, 0.0, -4.0);
assert_eq!(vec.norm2(), 17.0);

#### pub fn norm(&self) -> f64

Return the euclidean norm of a Vector3D

# Examples

let vec = Vector3D::new(1.0, 0.0, -4.0);
assert_eq!(vec.norm(), f64::sqrt(17.0));

#### pub fn normalized(&self) -> Vector3D

Normalize a Vector3D.

# Examples

let vec = Vector3D::new(1.0, 0.0, -4.0);
let n = vec.normalized();
assert_eq!(n.norm(), 1.0);

#### pub fn tensorial(&self, other: &Vector3D) -> Matrix3

Tensorial product between vectors. The tensorial product between the vectors a and b creates a Matrix3 with component (i, j) equals to a[i] * b[j].

# Examples

let a = Vector3D::new(1.0, 0.0, -4.0);
let b = Vector3D::new(1.0, 2.0, 3.0);
let matrix = Matrix3::new([
[1.0, 2.0, 3.0],
[0.0, 0.0, 0.0],
[-4.0, -8.0, -12.0]
]);
assert_eq!(a.tensorial(&b), matrix);

#### pub fn min(&self) -> f64

Get the minimal value in this vector, using std::f64::min for comparison.

# Examples

let vector = Vector3D::new(1.0, 0.0, -4.0);

assert_eq!(vector.min(), -4.0);

#### pub fn max(&self) -> f64

Get the maximal value in this vector, using std::f64::max for comparison.

# Examples

let vector = Vector3D::new(1.0, 0.0, -4.0);

assert_eq!(vector.max(), 1.0);

## Trait Implementations

### impl<'a> BitXor<&'a mut Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a> BitXor<Vector3D> for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a> BitXor<Vector3D> for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a> BitXor<&'a Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a, 'b> BitXor<&'a mut Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl BitXor<Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a, 'b> BitXor<&'a Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a, 'b> BitXor<&'a mut Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a, 'b> BitXor<&'a Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the ^ operator.

### impl<'a, 'b> Add<&'a mut Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a, 'b> Add<&'a mut Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a, 'b> Add<&'a Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a> Add<Vector3D> for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a> Add<&'a mut Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl Add<Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a> Add<Vector3D> for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a, 'b> Add<&'a Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a> Add<&'a Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the + operator.

### impl<'a, 'b> Sub<&'a Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a, 'b> Sub<&'a Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Sub<Vector3D> for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a, 'b> Sub<&'a mut Vector3D> for &'b mut Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl Sub<Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Sub<&'a Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Sub<&'a mut Vector3D> for Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Sub<Vector3D> for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a, 'b> Sub<&'a mut Vector3D> for &'b Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Neg for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Neg for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl Neg for Vector3D

#### type Output = Vector3D

The resulting type after applying the - operator.

### impl<'a> Mul<f64> for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a Vector3D> for &'b Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a Vector3D> for &'b mut Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a> Mul<Vector3D> for &'a mut Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a mut Vector3D> for &'b mut Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl Mul<Vector3D> for Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a mut Vector3D> for &'b Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<&'a Vector3D> for Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl Mul<f64> for Vector3D

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a mut Vector3D> for &'b mut Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<f64> for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl Mul<Vector3D> for Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<Vector3D> for &'a mut Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a Vector3D> for &'b mut Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<&'a mut Vector3D> for Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<Vector3D> for &'a Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a mut Vector3D> for &'b Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl<'a> Mul<&'a Vector3D> for Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a, 'b> Mul<&'a Vector3D> for &'b Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<Vector3D> for &'a Vector3D

#### type Output = f64

The resulting type after applying the * operator.

### impl<'a> Mul<&'a mut Vector3D> for Matrix3

#### type Output = Vector3D

The resulting type after applying the * operator.

### impl Deref for Vector3D

#### type Target = [f64; 3]

The resulting type after dereferencing.

### impl<'a> Div<f64> for &'a Vector3D

#### type Output = Vector3D

The resulting type after applying the / operator.

### impl<'a> Div<f64> for &'a mut Vector3D

#### type Output = Vector3D

The resulting type after applying the / operator.

### impl Div<f64> for Vector3D

#### type Output = Vector3D

The resulting type after applying the / operator.

## Blanket Implementations

### impl<T> ToOwned for T where    T: Clone, [src]

#### type Owned = T

The resulting type after obtaining ownership.

### impl<T, U> TryFrom<U> for T where    U: Into<T>, [src]

#### type Error = Infallible

The type returned in the event of a conversion error.

### impl<T, U> TryInto<U> for T where    U: TryFrom<T>, [src]

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.