summaryrefslogtreecommitdiff
path: root/src/lerp.rs
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2021-01-11 11:29:19 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2021-01-11 11:29:19 -0300
commit857b9974b7a8e89016357cc91ca4a37561ead7be (patch)
tree384152f45000ec0f519b673fbdbf46146f1ebff5 /src/lerp.rs
parent6ddf0167bf7d8a7a9f37fa37adfd2345cd5e4b89 (diff)
downloadbezier-857b9974b7a8e89016357cc91ca4a37561ead7be.tar.gz
bezier-857b9974b7a8e89016357cc91ca4a37561ead7be.zip
Refactor Poly
Diffstat (limited to 'src/lerp.rs')
-rw-r--r--src/lerp.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lerp.rs b/src/lerp.rs
index 8a33e8f..96506df 100644
--- a/src/lerp.rs
+++ b/src/lerp.rs
@@ -1,5 +1,5 @@
use crate::number::Number;
-use crate::poly::{self, Poly};
+use crate::poly::Poly;
pub enum Lerp {
Node(Box<Lerp>, Box<Lerp>),
@@ -23,12 +23,12 @@ impl Lerp {
pub fn lp(l: Box<Lerp>) -> Poly {
match *l {
- Lerp::Leaf(a, b) => vec![a, b - a],
+ Lerp::Leaf(a, b) => Poly(vec![a, b - a]),
Lerp::Node(a, b) => {
let a = lp(a);
let b = lp(b);
- let c = poly::sub(&b, &a);
- poly::skewed_sum(a, c)
+ let c = &b - &a;
+ &a + &(&c * &Poly(vec![0.0, 1.0]))
}
}
}