Skip to main content

Vector

Trait Vector 

Source
pub trait Vector:
    Copy
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Self::Scalar, Output = Self> {
    type Scalar: Scalar;

    // Required methods
    fn zero() -> Self;
    fn dot(self, rhs: Self) -> Self::Scalar;
    fn norm(self) -> Self::Scalar;
}
Expand description

A displacement or derivative in Euclidean space.

Vectors represent displacements and derivatives (e.g. tangent vectors). They form a linear space: addition, subtraction, and scalar multiplication are required, along with dot product and Euclidean norm.

Required Associated Types§

Source

type Scalar: Scalar

The scalar type used for components and magnitudes.

Required Methods§

Source

fn zero() -> Self

The zero vector (additive identity).

Source

fn dot(self, rhs: Self) -> Self::Scalar

Dot product of two vectors.

Source

fn norm(self) -> Self::Scalar

Euclidean norm (magnitude) of the vector.

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§