Merge #472
472: [breaking] Move lerp() from InnerSpace to VectorSpace r=Rhuagh a=Vlad-Shcherbina Because it does not require dot product. Along the way, fix the comment. Fixes #471. Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
This commit is contained in:
commit
a570349a0d
2 changed files with 10 additions and 7 deletions
|
@ -6,6 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Move `lerp()` from `InnerSpace` to `VectorSpace`
|
||||||
|
|
||||||
## [v0.16.1] - 2018-03-21
|
## [v0.16.1] - 2018-03-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -181,6 +181,13 @@ where
|
||||||
{
|
{
|
||||||
/// The associated scalar.
|
/// The associated scalar.
|
||||||
type Scalar: BaseNum;
|
type Scalar: BaseNum;
|
||||||
|
|
||||||
|
/// Returns the result of linearly interpolating the vector
|
||||||
|
/// towards `other` by the specified amount.
|
||||||
|
#[inline]
|
||||||
|
fn lerp(self, other: Self, amount: Self::Scalar) -> Self {
|
||||||
|
self + ((other - self) * amount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type with a distance function between values.
|
/// A type with a distance function between values.
|
||||||
|
@ -261,13 +268,6 @@ where
|
||||||
self * (magnitude / self.magnitude())
|
self * (magnitude / self.magnitude())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the result of linearly interpolating the magnitude of the vector
|
|
||||||
/// towards the magnitude of `other` by the specified amount.
|
|
||||||
#[inline]
|
|
||||||
fn lerp(self, other: Self, amount: Self::Scalar) -> Self {
|
|
||||||
self + ((other - self) * amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the
|
/// Returns the
|
||||||
/// [vector projection](https://en.wikipedia.org/wiki/Vector_projection)
|
/// [vector projection](https://en.wikipedia.org/wiki/Vector_projection)
|
||||||
/// of the current inner space projected onto the supplied argument.
|
/// of the current inner space projected onto the supplied argument.
|
||||||
|
|
Loading…
Reference in a new issue