Fix cubic Bézier interpolation.

This commit is contained in:
Dimitri Sabadie 2019-09-24 21:31:18 +02:00
parent 3ab98420c8
commit ea29e08836
No known key found for this signature in database
GPG Key ID: 784B10173D70584F
3 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,13 @@
# 2.0.1
> Tue Sep 24th 2019
- Fix the cubic Bézier curve interpolation. The “output” tangent is now taken by mirroring the
next keys tangent around its control point.
# 2.0.0 # 2.0.0
> Mon Sep 24th 2019 > Mon Sep 23rd 2019
## Major changes ## Major changes

View File

@ -1,6 +1,6 @@
[package] [package]
name = "splines" name = "splines"
version = "2.0.0" version = "2.0.1"
license = "BSD-3-Clause" license = "BSD-3-Clause"
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"] authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
description = "Spline interpolation made easy" description = "Spline interpolation made easy"

View File

@ -240,7 +240,10 @@ where V: Linear<T>,
let one_t_3 = one_t_2 * one_t; let one_t_3 = one_t_2 * one_t;
let three = T::one() + T::one() + T::one(); let three = T::one() + T::one() + T::one();
a.outer_mul(one_t_3) + u.outer_mul(three * one_t_2 * t) + v.outer_mul(three * one_t * t * t) + b.outer_mul(t * t * t) // mirror the “output” tangent based on the next key “input” tangent
let v_ = b + b - v;
a.outer_mul(one_t_3) + u.outer_mul(three * one_t_2 * t) + v_.outer_mul(three * one_t * t * t) + b.outer_mul(t * t * t)
} }
macro_rules! impl_interpolate_simple { macro_rules! impl_interpolate_simple {