Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
ab543b61e8 | |||
73df77380b | |||
08bcf902a4 | |||
bfb1cc14bb | |||
5836f778f4 | |||
7b5c08d9fa | |||
fe78bf2eb6 | |||
4b3a06d66e | |||
c50a9274a5 | |||
3ffe6106ec | |||
45244628ac | |||
69c166e630 | |||
da4c02202a | |||
05a3862e30 | |||
37ca7b1e2d | |||
680c863ce1 | |||
209d4fc7c5 | |||
51769e1b12 | |||
c32edbd4cb | |||
a175e86db7 |
61
CHANGELOG.md
61
CHANGELOG.md
@ -1,3 +1,64 @@
|
||||
# Changelog
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
* [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.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
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "splines"
|
||||
version = "3.4.0"
|
||||
version = "3.5.1"
|
||||
license = "BSD-3-Clause"
|
||||
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
|
||||
description = "Spline interpolation made easy"
|
||||
@ -22,17 +22,19 @@ 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.24", 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, < 0.9"
|
||||
|
@ -90,6 +90,9 @@ So here’s 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
88
src/glam.rs
Normal 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)
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
Reference in New Issue
Block a user