[][src]Struct tray_rust::linalg::vector::Vector

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

Vector is a standard 3 component vector

Fields

x: f32y: f32z: f32

Methods

impl Vector[src]

pub fn new(x: f32, y: f32, z: f32) -> Vector[src]

Initialize the vector and set values for x, y, z

pub fn broadcast(x: f32) -> Vector[src]

Initialize the vector with the same value of x, y, z

pub fn length_sqr(&self) -> f32[src]

Compute the squared length of the vector

pub fn length(&self) -> f32[src]

Compute the length of the vector

pub fn normalized(&self) -> Vector[src]

Get a normalized copy of this vector

Trait Implementations

impl Clone for Vector[src]

impl Copy for Vector[src]

impl PartialEq<Vector> for Vector[src]

impl PartialOrd<Vector> for Vector[src]

impl Debug for Vector[src]

impl Div<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the / operator.

fn div(self, rhs: Vector) -> Vector[src]

Divide the vectors components by the right hand side's components

impl Div<f32> for Vector[src]

type Output = Vector

The resulting type after applying the / operator.

fn div(self, rhs: f32) -> Vector[src]

Divide the vectors components by a scalar

impl Sub<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the - operator.

fn sub(self, rhs: Vector) -> Vector[src]

Subtract two vectors

impl Sub<Vector> for Point[src]

type Output = Point

The resulting type after applying the - operator.

fn sub(self, rhs: Vector) -> Point[src]

Subtract a vector from a point, translating the point by -vector

impl Add<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the + operator.

fn add(self, rhs: Vector) -> Vector[src]

Add two vectors together

impl Add<Vector> for Point[src]

type Output = Point

The resulting type after applying the + operator.

fn add(self, rhs: Vector) -> Point[src]

Add two points together

impl Mul<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the * operator.

fn mul(self, rhs: Vector) -> Vector[src]

Multiply two vectors

impl Mul<f32> for Vector[src]

type Output = Vector

The resulting type after applying the * operator.

fn mul(self, rhs: f32) -> Vector[src]

Scale the vector by some value

impl Mul<Vector> for f32[src]

type Output = Vector

The resulting type after applying the * operator.

fn mul(self, rhs: Vector) -> Vector[src]

Scale the vector by some value

impl Mul<Point> for Vector[src]

type Output = Point

The resulting type after applying the * operator.

fn mul(self, rhs: Point) -> Point[src]

Scale the vector by some value

impl Mul<Vector> for Point[src]

type Output = Point

The resulting type after applying the * operator.

fn mul(self, rhs: Vector) -> Point[src]

Scale the vector by some value

impl Mul<Vector> for Transform[src]

type Output = Vector

The resulting type after applying the * operator.

fn mul(self, v: Vector) -> Vector[src]

Multiply the vector by the transform to apply the transformation

impl Neg for Vector[src]

type Output = Vector

The resulting type after applying the - operator.

fn neg(self) -> Vector[src]

Negate the vector

impl Index<usize> for Vector[src]

type Output = f32

The returned type after indexing.

fn index(&self, i: usize) -> &f32[src]

Access the vector by index

  • 0 = x
  • 1 = y
  • 2 = z

impl IndexMut<usize> for Vector[src]

fn index_mut(&mut self, i: usize) -> &mut f32[src]

Access the vector by index

  • 0 = x
  • 1 = y
  • 2 = z

impl StructuralPartialEq for Vector[src]

Auto Trait Implementations

impl Send for Vector

impl Sync for Vector

impl Unpin for Vector

impl UnwindSafe for Vector

impl RefUnwindSafe for Vector

Blanket Implementations

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

impl<T> From<T> for T[src]

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.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Interpolate for T where
    T: Add<T, Output = T> + Mul<f32, Output = T> + Copy
[src]

impl<T> SetParameter for T[src]