[][src]Struct myelin_geometry::Vector

pub struct Vector {
    pub x: f64,
    pub y: f64,
}

A vector

Fields

x: f64

The x component of the Vector

y: f64

The y component of the Vector

Methods

impl Vector[src]

pub fn dot_product(self, other: Self) -> f64[src]

Calculates the dot product of itself and another vector

Examples

use myelin_geometry::Vector;
// a · b = c
let a = Vector { x: 2.0, y: 3.0 };
let b = Vector { x: -4.0, y: 10.0 };
let c = a.dot_product(b);
assert_eq!(22.0, c);

pub fn cross_product(self, other: Self) -> f64[src]

Calculates the cross product of itself and another vector

Examples

use myelin_geometry::Vector;
// a × b = c
let a = Vector { x: 2.0, y: 3.0 };
let b = Vector { x: -4.0, y: 10.0 };
let c = a.cross_product(b);
assert_eq!(32.0, c);

Trait Implementations

impl From<Point> for Vector[src]

impl From<Vector> for Point[src]

impl Default for Vector[src]

impl Copy for Vector[src]

impl PartialEq<Vector> for Vector[src]

impl Clone for Vector[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Vector[src]

impl Add<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the + operator.

impl Sub<Vector> for Vector[src]

type Output = Vector

The resulting type after applying the - operator.

impl Serialize for Vector[src]

impl<'de> Deserialize<'de> for Vector[src]

Auto Trait Implementations

impl Send for Vector

impl Sync for Vector

Blanket Implementations

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

impl<T> From for T[src]

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]