Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bezier_pt function outside of bezier interpolation function to avoid rustc ICE 34027. #19

Merged
merged 3 commits into from
Jul 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: rust

rust:
- nightly
- beta
- stable

os:
Expand All @@ -11,4 +12,5 @@ os:
script:
- cargo build --verbose
- cargo test --verbose
- cargo test --features="serde_serialization" --verbose
- cargo doc --verbose
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "envelope"
description = "An interpolatable Envelope trait along with a generic 2D Point trait. Useful for controlling parameters over time."
version = "0.8.0"
version = "0.8.1"
authors = ["mitchmindtree <mitchell.nordine@gmail.com>"]
readme = "README.md"
keywords = ["interpolate", "dsp", "audio", "time", "2D"]
Expand Down
17 changes: 8 additions & 9 deletions src/interpolate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ pub fn ease<P>(x: P::X, start: &P, end: &P, ease_fn: EaseFunction) -> P::Y
}


/// Get bezier point for bezier curve.
#[inline]
fn bezier_pt<T>(n1: T, n2: T, perc: T) -> T
where T: Scalar
{
(n2 - n1.clone()) * perc + n1
}

/// Interpolate between the given start and end points given some bezier curve.
#[inline]
pub fn bezier<P>(x: P::X, start: &P, end: &P, curve: <P::Y as Spatial>::Scalar) -> P::Y
Expand All @@ -85,15 +93,6 @@ pub fn bezier<P>(x: P::X, start: &P, end: &P, curve: <P::Y as Spatial>::Scalar)
<P::Y as Spatial>::Scalar: Scalar + NumCast,
{
maybe_exact_point(&x, start, end).unwrap_or_else(|| {

/// Get bezier point for bezier curve.
#[inline]
fn bezier_pt<T>(n1: T, n2: T, perc: T) -> T
where T: Scalar
{
(n2 - n1.clone()) * perc + n1
}

let x = P::x_to_scalar(x.clone());
let start_x = P::x_to_scalar(start.x());
let end_x = P::x_to_scalar(end.x());
Expand Down