Trait Merge

Source
pub trait Merge<T = f64> {
    // Required method
    fn merge(self, to: Self, factor: T) -> Self;
}
Expand description

The merge trait is used to merge two elements together.

Often this is a linear interpolation between two elements. In the case of Quaternions it is a spherical linear interpolation.

A default implementation of this trait is provided for all E that are Add<Output = E> + Mul<T, Output = E> + Copy as these operations let us assume that the elements live in a vector-like space.

If the struct implementing this trait also implements Topology, the merge(factor) method should be equivalent to self.shortest_path(to).contract(factor).

Required Methods§

Source

fn merge(self, to: Self, factor: T) -> Self

Merge between self and to using factor.

This can be thought of creating a point on (one of) the shortest Paths between the two given points.

Merging self with a factor of Zero should return a copy of self. Merging to with a factor of One should return a copy of to. It is assumed that the factor decides how similar the result will be to either self or to.

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§

Source§

impl<E, T> Merge<T> for E
where E: Add<Output = E> + Mul<T, Output = E> + Copy, T: Real,