30 Commits
3.3 ... 3.5.3

Author SHA1 Message Date
c0d9a0b540 Prepare 3.5.3. 2021-01-16 17:04:27 +01:00
4f0bf51b5c Fix README. 2021-01-16 17:03:28 +01:00
cc2b9c75a0 Prepare 3.5.2. 2021-01-01 16:59:52 +01:00
60952acb73 Merge pull request #55 from phaazon/dependabot/cargo/master/nalgebra-gte-0.21-and-lt-0.25
Update nalgebra requirement from >=0.21, <0.24 to >=0.21, <0.25
2021-01-01 03:07:31 +01:00
fb67b32959 Update nalgebra requirement from >=0.21, <0.24 to >=0.21, <0.25
Updates the requirements on [nalgebra](https://github.com/rustsim/nalgebra) to permit the latest version.
- [Release notes](https://github.com/rustsim/nalgebra/releases)
- [Changelog](https://github.com/dimforge/nalgebra/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/rustsim/nalgebra/compare/v0.21.0...v0.24.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-12-30 14:33:27 +00:00
ab543b61e8 Merge pull request #54 from phaazon/dependabot/cargo/master/glam-0.11
Update glam requirement from 0.10 to 0.11
2020-12-05 16:39:28 +01:00
73df77380b Prepare 3.5.1. 2020-12-05 16:34:56 +01:00
08bcf902a4 Update glam requirement from 0.10 to 0.11
Updates the requirements on [glam](https://github.com/bitshifter/glam-rs) to permit the latest version.
- [Release notes](https://github.com/bitshifter/glam-rs/releases)
- [Changelog](https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bitshifter/glam-rs/compare/0.10.0...0.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-25 20:41:04 +00:00
bfb1cc14bb Merge pull request #53 from phaazon/release/3.5
Release/3.5
2020-11-23 22:38:09 +01:00
5836f778f4 Prepare 3.5. 2020-11-23 22:29:22 +01:00
7b5c08d9fa Add support for nalgebra-0.23. 2020-11-23 22:29:22 +01:00
fe78bf2eb6 Merge pull request #50 from iwikal/glam
Add impl-glam feature
2020-11-23 22:20:50 +01:00
4b3a06d66e Update glam 2020-11-02 04:04:06 +01:00
c50a9274a5 glam::Quat::lerp normalizes internally 2020-10-25 22:11:25 +01:00
3ffe6106ec Add impl-glam feature 2020-10-25 22:00:13 +01:00
45244628ac Prepare 3.4.2. 2020-10-24 23:44:25 +02:00
69c166e630 Merge pull request #49 from phaazon/dependabot/cargo/master/simba-gte-0.1.2-and-lt-0.4
Update simba requirement from >=0.1.2, <0.3 to >=0.1.2, <0.4
2020-10-24 23:41:07 +02:00
da4c02202a Update simba requirement from >=0.1.2, <0.3 to >=0.1.2, <0.4
Updates the requirements on [simba](https://github.com/dimforge/simba) to permit the latest version.
- [Release notes](https://github.com/dimforge/simba/releases)
- [Changelog](https://github.com/dimforge/simba/blob/master/CHANGELOG)
- [Commits](https://github.com/dimforge/simba/compare/v0.1.2...v0.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-24 16:24:09 +00:00
05a3862e30 Prepare 3.4.1. 2020-09-05 15:25:16 +02:00
37ca7b1e2d Merge pull request #45 from phaazon/dependabot/cargo/master/simba-0.2.0
Update simba requirement from 0.1.2 to 0.2.0
2020-09-05 15:24:24 +02:00
680c863ce1 Merge pull request #46 from phaazon/dependabot/cargo/master/nalgebra-0.22
Update nalgebra requirement from 0.21 to 0.22
2020-09-05 15:24:18 +02:00
209d4fc7c5 Add support for nalgebra-0.22. 2020-09-05 15:16:33 +02:00
51769e1b12 Add support of simba-0.2. 2020-09-05 15:15:28 +02:00
c32edbd4cb Update nalgebra requirement from 0.21 to 0.22
Updates the requirements on [nalgebra](https://github.com/rustsim/nalgebra) to permit the latest version.
- [Release notes](https://github.com/rustsim/nalgebra/releases)
- [Changelog](https://github.com/dimforge/nalgebra/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/rustsim/nalgebra/compare/v0.21.0...v0.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-25 19:28:24 +00:00
a175e86db7 Update simba requirement from 0.1.2 to 0.2.0
Updates the requirements on [simba](https://github.com/dimforge/simba) to permit the latest version.
- [Release notes](https://github.com/dimforge/simba/releases)
- [Changelog](https://github.com/dimforge/simba/blob/master/CHANGELOG)
- [Commits](https://github.com/dimforge/simba/compare/v0.1.2...v0.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-08-25 18:46:32 +00:00
ebfc15d8af Prepare 3.4. 2020-05-21 20:11:36 +02:00
5b92d7b715 Merge pull request #43 from phaazon/dependabot/cargo/master/float-cmp-0.8
Update float-cmp requirement from 0.6 to 0.8
2020-05-21 20:04:34 +02:00
8f7cc9e711 Bump float-cmp upper bound to accept float-cmp-0.8. 2020-05-21 19:59:48 +02:00
9d930d6f16 Update float-cmp requirement from 0.6 to 0.8
Updates the requirements on [float-cmp](https://github.com/mikedilger/float-cmp) to permit the latest version.
- [Release notes](https://github.com/mikedilger/float-cmp/releases)
- [Commits](https://github.com/mikedilger/float-cmp/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-04 22:42:05 +00:00
0afebc3319 Synchronize README. 2020-04-29 03:27:10 +02:00
5 changed files with 189 additions and 9 deletions

View File

@ -1,6 +1,88 @@
# Changelog
<!-- vim-markdown-toc GFM -->
* [3.5.3](#353)
* [3.5.2](#352)
* [3.5.1](#351)
* [3.5](#35)
* [3.4.2](#342)
* [3.4.1](#341)
* [3.4](#34)
* [3.3](#33)
* [3.2](#32)
* [3.1](#31)
* [3.0](#30)
* [Major changes](#major-changes)
* [Patch changes](#patch-changes)
* [2.2](#22)
* [2.1.1](#211)
* [2.1](#21)
* [2.0.1](#201)
* [2.0](#20)
* [Major changes](#major-changes-1)
* [Minor changes](#minor-changes)
* [1.0](#10)
* [Major changes](#major-changes-2)
* [Minor changes](#minor-changes-1)
* [Patch changes](#patch-changes-1)
* [0.2.3](#023)
* [0.2.2](#022)
* [0.2.1](#021)
* [0.2](#02)
* [0.1.1](#011)
* [0.1](#01)
<!-- vim-markdown-toc -->
# 3.5.3
> Jan 16, 2021
- Resynchronize and fix links in the README (fix in `cargo sync-readme`).
# 3.5.2
> Fri Jan 01, 2021
- Support of `nalgebra-0.24`.
# 3.5.1
> Dec 5th, 2020
- Support of `glam-0.11`.
# 3.5
> Nov 23rd, 2020
- Add support for [glam](https://crates.io/crates/glam) via the `"impl-glam"` feature gate.
- Support of `nalgebra-0.23`.
# 3.4.2
> Oct 24th, 2020
- Support of `simba-0.3`.
# 3.4.1
> Sep 5th, 2020
- Support of `simba-0.2`.
- Support of `nalgebra-0.22`.
# 3.4
> Thu May 21st 2020
- Add support for `float-cmp-0.7` and `float-cmp-0.8`. Because this uses a SemVer range, if you
already have a `Cargo.lock`, dont forget to update `splines` with `cargo update --aggressive`.
# 3.3
> Thu Apr 0th 2020
> Thu Apr 10th 2020
- Add support for `nalgebra-0.21`.

View File

@ -1,6 +1,6 @@
[package]
name = "splines"
version = "3.3.0"
version = "3.5.3"
license = "BSD-3-Clause"
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
description = "Spline interpolation made easy"
@ -22,20 +22,22 @@ maintenance = { status = "actively-developed" }
[features]
default = ["std"]
impl-cgmath = ["cgmath"]
impl-glam = ["glam"]
impl-nalgebra = ["nalgebra", "num-traits", "simba"]
serialization = ["serde", "serde_derive"]
std = []
[dependencies]
cgmath = { version = "0.17", optional = true }
nalgebra = { version = "0.21", optional = true }
glam = { version = ">=0.10, <0.12", optional = true }
nalgebra = { version = ">=0.21, <0.25", optional = true }
num-traits = { version = "0.2", optional = true }
serde = { version = "1", optional = true }
serde_derive = { version = "1", optional = true }
simba = { version = "0.1.2", optional = true }
simba = { version = ">=0.1.2, <0.4", optional = true }
[dev-dependencies]
float-cmp = "0.6"
float-cmp = ">=0.6, < 0.9"
serde_json = "1"
[package.metadata.docs.rs]

View File

@ -24,7 +24,7 @@ is picked from its lower control point.
# Quickly create splines
```
```rust
use splines::{Interpolation, Key, Spline};
let start = Key::new(0., 0., Interpolation::Linear);
@ -46,7 +46,7 @@ value.
If you try to sample in out-of-bounds sampling parameter, youll get no value.
```
```rust
assert_eq!(spline.sample(0.), Some(0.));
assert_eq!(spline.clamped_sample(1.), Some(10.));
assert_eq!(spline.sample(1.1), None);
@ -56,7 +56,7 @@ Its possible that you want to get a value even if youre out-of-bounds. Thi
important for simulations / animations. Feel free to use the `Spline::clamped_interpolation` for
that purpose.
```
```rust
assert_eq!(spline.clamped_sample(-0.9), Some(0.)); // clamped to the first key
assert_eq!(spline.clamped_sample(1.1), Some(10.)); // clamped to the last key
```
@ -66,7 +66,7 @@ assert_eq!(spline.clamped_sample(1.1), Some(10.)); // clamped to the last key
[`Spline`] curves are parametered both by the carried value (being interpolated) but also the
sampling type. Its very typical to use `f32` or `f64` but really, you can in theory use any
kind of type; that type must, however, implement a contract defined by a set of traits to
implement. See [the documentation of this module](crate::interpolate) for further details.
implement. See [the documentation of this module](https://docs.rs/splines/latest/splines/interpolate/) for further details.
# Features and customization
@ -90,6 +90,9 @@ So heres a list of currently supported features and how to enable them:
- **[cgmath](https://crates.io/crates/cgmath) implementors.**
- Adds some useful implementations of `Interpolate` for some cgmath types.
- Enable with the `"impl-cgmath"` feature.
- **[glam](https://crates.io/crates/glam) implementors.**
- Adds some useful implementations of `Interpolate` for some glam types.
- Enable with the `"impl-glam"` feature.
- **[nalgebra](https://crates.io/crates/nalgebra) implementors.**
- Adds some useful implementations of `Interpolate` for some nalgebra types.
- Enable with the `"impl-nalgebra"` feature.

88
src/glam.rs Normal file
View File

@ -0,0 +1,88 @@
use glam::{Quat, Vec2, Vec3, Vec3A, Vec4};
use crate::interpolate::{
cubic_bezier_def, cubic_hermite_def, quadratic_bezier_def, Interpolate, Linear,
};
macro_rules! impl_interpolate_vec {
($($t:tt)*) => {
impl Linear<f32> for $($t)* {
#[inline(always)]
fn outer_mul(self, t: f32) -> Self {
self * t
}
#[inline(always)]
fn outer_div(self, t: f32) -> Self {
self / t
}
}
impl Interpolate<f32> for $($t)* {
#[inline(always)]
fn lerp(a: Self, b: Self, t: f32) -> Self {
a.lerp(b, t)
}
#[inline(always)]
fn cubic_hermite(
x: (Self, f32),
a: (Self, f32),
b: (Self, f32),
y: (Self, f32),
t: f32,
) -> Self {
cubic_hermite_def(x, a, b, y, t)
}
#[inline(always)]
fn quadratic_bezier(a: Self, u: Self, b: Self, t: f32) -> Self {
quadratic_bezier_def(a, u, b, t)
}
#[inline(always)]
fn cubic_bezier(a: Self, u: Self, v: Self, b: Self, t: f32) -> Self {
cubic_bezier_def(a, u, v, b, t)
}
}
}
}
impl_interpolate_vec!(Vec2);
impl_interpolate_vec!(Vec3);
impl_interpolate_vec!(Vec3A);
impl_interpolate_vec!(Vec4);
impl Linear<f32> for Quat {
#[inline(always)]
fn outer_mul(self, t: f32) -> Self {
self * t
}
#[inline(always)]
fn outer_div(self, t: f32) -> Self {
self / t
}
}
impl Interpolate<f32> for Quat {
#[inline(always)]
fn lerp(a: Self, b: Self, t: f32) -> Self {
a.lerp(b, t)
}
#[inline(always)]
fn cubic_hermite(x: (Self, f32), a: (Self, f32), b: (Self, f32), y: (Self, f32), t: f32) -> Self {
cubic_hermite_def(x, a, b, y, t)
}
#[inline(always)]
fn quadratic_bezier(a: Self, u: Self, b: Self, t: f32) -> Self {
quadratic_bezier_def(a, u, b, t)
}
#[inline(always)]
fn cubic_bezier(a: Self, u: Self, v: Self, b: Self, t: f32) -> Self {
cubic_bezier_def(a, u, v, b, t)
}
}

View File

@ -91,6 +91,9 @@
//! - **[cgmath](https://crates.io/crates/cgmath) implementors.**
//! - Adds some useful implementations of `Interpolate` for some cgmath types.
//! - Enable with the `"impl-cgmath"` feature.
//! - **[glam](https://crates.io/crates/glam) implementors.**
//! - Adds some useful implementations of `Interpolate` for some glam types.
//! - Enable with the `"impl-glam"` feature.
//! - **[nalgebra](https://crates.io/crates/nalgebra) implementors.**
//! - Adds some useful implementations of `Interpolate` for some nalgebra types.
//! - Enable with the `"impl-nalgebra"` feature.
@ -111,6 +114,8 @@ extern crate alloc;
#[cfg(feature = "impl-cgmath")]
mod cgmath;
#[cfg(feature = "impl-glam")]
mod glam;
pub mod interpolate;
pub mod interpolation;
pub mod iter;