Simplify approximate_edge

This commit is contained in:
Hanno Braun 2022-03-22 15:10:14 +01:00
parent e22fec9e79
commit 6854755be4

View File

@ -73,18 +73,17 @@ fn approximate_edge(
points.push(b.point());
}
let mut segment_points = points.clone();
if vertices.is_none() {
// The edge has no vertices, which means it connects to itself. We need
// to reflect that in the approximation.
if let Some(&point) = points.first() {
segment_points.push(point);
points.push(point);
}
}
let mut segments = HashSet::new();
for segment in segment_points.windows(2) {
for segment in points.windows(2) {
let p0 = segment[0];
let p1 = segment[1];