@@ -51,20 +51,21 @@ pub fn sample_points_on_bezpath(bezpath: BezPath, spacing: f64, start_offset: f6
51
51
if sample_count < 1. {
52
52
return None ;
53
53
}
54
+
54
55
// Generate points along the path based on calculated intervals.
55
- let mut length_upto_previous_segment = 0. ;
56
+ let mut length_up_to_previous_segment = 0. ;
56
57
let mut next_segment_index = 0 ;
57
58
58
59
for count in 0 ..=sample_count as usize {
59
60
let fraction = count as f64 / sample_count;
60
- let length_upto_next_sample_point = fraction * used_length + start_offset;
61
- let mut next_length = length_upto_next_sample_point - length_upto_previous_segment ;
61
+ let length_up_to_next_sample_point = fraction * used_length + start_offset;
62
+ let mut next_length = length_up_to_next_sample_point - length_up_to_previous_segment ;
62
63
let mut next_segment_length = segments_length[ next_segment_index] ;
63
64
64
- // Keep moving to the next segment while the next sample point length is less or equals to the length upto that segment.
65
+ // Keep moving to the next segment while the next sample point length is less or equals to the length up to that segment.
65
66
while next_length > next_segment_length && ( next_length - next_segment_length) > POSITION_ACCURACY {
66
- length_upto_previous_segment += next_segment_length;
67
- next_length = length_upto_next_sample_point - length_upto_previous_segment ;
67
+ length_up_to_previous_segment += next_segment_length;
68
+ next_length = length_up_to_next_sample_point - length_up_to_previous_segment ;
68
69
next_segment_index += 1 ;
69
70
next_segment_length = segments_length[ next_segment_index] ;
70
71
}
@@ -93,7 +94,7 @@ pub fn t_value_to_parametric(bezpath: &BezPath, t: f64, euclidian: bool, segment
93
94
}
94
95
95
96
/// Finds the t value of point on the given path segment i.e fractional distance along the segment's total length.
96
- /// It uses a binary search to find the value `t` such that the ratio `length_upto_t / total_length` approximates the input `distance`.
97
+ /// It uses a binary search to find the value `t` such that the ratio `length_up_to_t / total_length` approximates the input `distance`.
97
98
pub fn eval_pathseg_euclidean ( path : kurbo:: PathSeg , distance : f64 , accuracy : f64 ) -> f64 {
98
99
let mut low_t = 0. ;
99
100
let mut mid_t = 0.5 ;
0 commit comments