From 70b5188de306b70cdf8a397dd4e0ee31f07050c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sun, 17 Jan 2021 20:25:58 -0300 Subject: Fix curve overextending past last control point --- src/poly/iter.rs | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 src/poly/iter.rs (limited to 'src/poly/iter.rs') 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, - degree: usize, -} - -impl Iter { - pub fn new(data: Vec, degree: usize) -> Iter { - Iter { - index: 0, - data, - degree, - } - } - - pub fn zip(self, other: Self) -> Zip, Take> { - 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 { - self.index += 1; - if self.index <= self.data.len() { - Some(self.data[self.index - 1]) - } else { - Some(0.0) - } - } -} -- cgit v1.2.3