Trait topology_traits::Merge[][src]

pub trait Merge<T = f64> {
    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

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.

Implementors