Skip to content

Commit 8a07b4a

Browse files
committed
Update comments.
1 parent 08d105d commit 8a07b4a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

plotters/src/element/basic_shapes.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,25 @@ impl<I0: Iterator + Clone, Size: SizeDesc, DB: DrawingBackend> Drawable<DB>
195195
let mut d = dx.hypot(dy).max(f32::EPSILON);
196196
let scale = size / d;
197197
let gap_scale = spacing / d;
198+
// Start drawing until last segment
199+
// 1) o-- -- o (need to patch last one)
200+
// 2) o-- -- o (ignore the last one)
201+
// 3) o o (points are too dense)
198202
while d >= size {
199-
// solid line
203+
// Solid line
200204
let end = (start.0 + dx * scale, start.1 + dy * scale);
201205
backend.draw_path([to_i(start), to_i(end)], &self.style)?;
202-
// spacing
206+
// Spacing
203207
start = (end.0 + dx * gap_scale, end.1 + dy * gap_scale);
204208
d -= size + spacing;
205209
}
206-
// the last point
210+
// Finish the last segment
211+
// 1) o-- -- -o (patched)
212+
// 2) o-o (become solid line)
207213
if d > 0. {
208214
backend.draw_path([to_i(start), curr], &self.style)?;
209215
}
216+
// Move to the current point
210217
start = curr_f;
211218
}
212219
Ok(())

0 commit comments

Comments
 (0)