Skip to content

Commit f201a9d

Browse files
authored
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.
1 parent 8e82c88 commit f201a9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/bevy_math/src/cubic_splines.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ impl<P: Point> CubicCurve<P> {
483483
subdivisions: usize,
484484
sample_function: fn(&Self, f32) -> P,
485485
) -> impl Iterator<Item = P> + '_ {
486-
(0..subdivisions).map(move |i| {
486+
(0..=subdivisions).map(move |i| {
487487
let segments = self.segments.len() as f32;
488488
let t = i as f32 / subdivisions as f32 * segments;
489489
sample_function(self, t)

0 commit comments

Comments
 (0)