Skip to main content

Cross

Trait Cross 

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

A vector space where the cross product is defined.

Required Methods§

Source

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

Perform the cross product. 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§