Fix CubicCurve::iter_samples iteration count (#8049)

# Objective

Fix `CubicCurve::iter_samples` iteration count.

## Solution

If I understand the function and the docs correctly, this should iterate
over `0..=subdivisions` instead of `0..subdivisions`.
For example: Now the iteration returns 3 points at `subdivisions = 2`,
as indicated in the documentation.
This commit is contained in:
Jannik Obermann 2023-03-31 10:15:21 +02:00 committed by GitHub
parent 8e82c88131
commit f201a9df39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -483,7 +483,7 @@ impl<P: Point> CubicCurve<P> {
subdivisions: usize,
sample_function: fn(&Self, f32) -> P,
) -> impl Iterator<Item = P> + '_ {
(0..subdivisions).map(move |i| {
(0..=subdivisions).map(move |i| {
let segments = self.segments.len() as f32;
let t = i as f32 / subdivisions as f32 * segments;
sample_function(self, t)