Merge pull request #98 from EmbarkStudios/master

Add `clear` method to `Spline`
This commit is contained in:
Dimitri Sabadie 2023-09-23 15:40:26 +02:00 committed by GitHub
commit 2179c8300f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,13 @@ impl<T, V> Spline<T, V> {
spline.internal_sort(); spline.internal_sort();
spline spline
} }
/// Clear the spline by removing all keys. Keeps the underlying allocated storage, so adding
/// new keys should be faster than creating a new [`Spline`]
#[inline]
pub fn clear(&mut self) {
self.0.clear()
}
/// Create a new spline by consuming an `Iterater<Item = Key<T>>`. They keys dont have to be /// Create a new spline by consuming an `Iterater<Item = Key<T>>`. They keys dont have to be
/// sorted. /// sorted.