summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2021-01-30 16:30:43 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2021-01-30 16:30:43 -0300
commitf7f8755215f2701698e173ad753f282231655bdd (patch)
tree68879c722ea0098c0a708a6de38475cb54bb4241 /src/lib.rs
parent4998f5936dc7da36aba0cd018de2a1a6127dda08 (diff)
downloadbezier-f7f8755215f2701698e173ad753f282231655bdd.tar.gz
bezier-f7f8755215f2701698e173ad753f282231655bdd.zip
Optimize lerp creation
Now it uses Rc instead of Box, reducing the space and time complexity from O(2^n) to O(n^2).
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6f26672..d6a1374 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@ pub struct Bezier {
pub px: Poly,
pub py: Poly,
pub dpx: Poly,
- pub dpy: Poly
+ pub dpy: Poly,
}
impl Bezier {
@@ -47,7 +47,7 @@ impl Bezier {
self.degree -= 1;
}
- pub fn show_x(&self) -> String{
+ pub fn show_x(&self) -> String {
let mut s = String::new();
for i in 0..self.degree {
s.push_str(&self.vx[i].to_string());