Skip to content

Commit a2876d6

Browse files
committed
improve comment & variable name
1 parent 7d3c7a2 commit a2876d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn sample_points_on_bezpath(bezpath: BezPath, spacing: f64, start_offset: f6
6262
let mut next_length = length_up_to_next_sample_point - length_up_to_previous_segment;
6363
let mut next_segment_length = segments_length[next_segment_index];
6464

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+
// Keep moving to the next segment while the length up to the next sample point is less or equals to the length up to the segment.
6666
while next_length > next_segment_length {
6767
if next_segment_index == segments_length.len() - 1 {
6868
break;
@@ -100,12 +100,12 @@ pub fn t_value_to_parametric(bezpath: &BezPath, t: f64, euclidian: bool, segment
100100

101101
/// Finds the t value of point on the given path segment i.e fractional distance along the segment's total length.
102102
/// It uses a binary search to find the value `t` such that the ratio `length_up_to_t / total_length` approximates the input `distance`.
103-
pub fn eval_pathseg_euclidean(path: kurbo::PathSeg, distance: f64, accuracy: f64) -> f64 {
103+
pub fn eval_pathseg_euclidean(path_segment: kurbo::PathSeg, distance: f64, accuracy: f64) -> f64 {
104104
let mut low_t = 0.;
105105
let mut mid_t = 0.5;
106106
let mut high_t = 1.;
107107

108-
let total_length = path.perimeter(accuracy);
108+
let total_length = path_segment.perimeter(accuracy);
109109

110110
if !total_length.is_finite() || total_length <= f64::EPSILON {
111111
return 0.;
@@ -114,7 +114,7 @@ pub fn eval_pathseg_euclidean(path: kurbo::PathSeg, distance: f64, accuracy: f64
114114
let distance = distance.clamp(0., 1.);
115115

116116
while high_t - low_t > accuracy {
117-
let current_length = path.subsegment(0.0..mid_t).perimeter(accuracy);
117+
let current_length = path_segment.subsegment(0.0..mid_t).perimeter(accuracy);
118118
let current_distance = current_length / total_length;
119119

120120
if current_distance > distance {

0 commit comments

Comments
 (0)