diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-17 20:25:58 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-17 20:25:58 -0300 |
commit | 70b5188de306b70cdf8a397dd4e0ee31f07050c8 (patch) | |
tree | 3721070393126b79a3658fe8a89f1fa98a84db44 /src/poly/iter.rs | |
parent | 18efe0d28ebcd936ea50275a351ef1c30253ea1c (diff) | |
download | bezier-70b5188de306b70cdf8a397dd4e0ee31f07050c8.tar.gz bezier-70b5188de306b70cdf8a397dd4e0ee31f07050c8.zip |
Fix curve overextending past last control point
Diffstat (limited to 'src/poly/iter.rs')
-rw-r--r-- | src/poly/iter.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/poly/iter.rs b/src/poly/iter.rs deleted file mode 100644 index 90cc4b5..0000000 --- a/src/poly/iter.rs +++ /dev/null @@ -1,38 +0,0 @@ -use std::cmp; -use std::iter::{Take, Zip}; - -pub struct Iter { - index: usize, - data: Vec<f32>, - degree: usize, -} - -impl Iter { - pub fn new(data: Vec<f32>, degree: usize) -> Iter { - Iter { - index: 0, - data, - degree, - } - } - - pub fn zip(self, other: Self) -> Zip<Take<Iter>, Take<Iter>> { - let deg = cmp::max(self.degree, other.degree) + 1; - let a = self.take(deg); - let b = other.take(deg); - a.zip(b) - } -} - -impl Iterator for Iter { - type Item = f32; - - fn next(&mut self) -> Option<f32> { - self.index += 1; - if self.index <= self.data.len() { - Some(self.data[self.index - 1]) - } else { - Some(0.0) - } - } -} |