Skip to main content

Cross

Trait Cross 

Source
pub trait Cross {
    // Required method
    fn cross(&self, other: &Self) -> Self;
}
Expand description

The vector cross product.

The result of a vector cross product is in the same vector space as the operands.

Required Methods§

Source

fn cross(&self, other: &Self) -> Self

Compute the cross product (right-handed) of two vectors:

\vec{c} = \vec{a} × \vec{b}
§Example
use hoomd_vector::{Cartesian, Cross, Vector};

let a = Cartesian::from([1.0, 0.0, 0.0]);
let b = Cartesian::from([0.0, 1.0, 0.0]);
let c = a.cross(&b);
assert_eq!(c, [0.0, 0.0, 1.0].into());

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§