Skip to main content

Blend

Trait Blend 

Source
pub trait Blend: Copy {
    // Required methods
    fn zero() -> Self;
    fn scale(self, k: f64) -> Self;
    fn add(self, other: Self) -> Self;

    // Provided methods
    fn lerp(self, other: Self, t: f64) -> Self { ... }
    fn sub(self, other: Self) -> Self { ... }
}
Expand description

The affine structure a control point needs: scaling and addition.

Implemented for vectors, points and scalars. de Boor and the refinement algorithms take only affine combinations (coefficients summing to one), so applying them to positions is meaningful even though positions have no meaningful sum on their own.

Required Methods§

Source

fn zero() -> Self

The additive identity.

Source

fn scale(self, k: f64) -> Self

Scale by a factor.

Source

fn add(self, other: Self) -> Self

Add another value.

Provided Methods§

Source

fn lerp(self, other: Self, t: f64) -> Self

self * (1 - t) + other * t.

Source

fn sub(self, other: Self) -> Self

Subtract, via scaling by -1.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Blend for f64

Source§

fn zero() -> Self

Source§

fn scale(self, k: f64) -> Self

Source§

fn add(self, other: Self) -> Self

Implementors§