You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Special case; The next line is long. If we were to remove this, it could happen that we get quite noticeable artifacts.
392
392
// We should instead move this point to a location where both edges are kept and then remove the previous point that we wanted to keep.
393
-
// By taking the average of the projections of the original points on the outer lines, we get a point that mostly preserves the direction (so it makes the corner a bit more pointy).
393
+
// By taking the intersection of these two lines, we get a point that preserves the direction (so it makes the corner a bit more pointy).
394
394
// We just need to be sure that the intersection point does not introduce an artifact itself.
395
-
const Point mid = (previous + current) / 2;
396
-
const Point a = LinearAlg2D::projectPointOnLine(mid, previous_previous, previous);
397
-
const Point b = LinearAlg2D::projectPointOnLine(mid, current, next);
398
-
const Point intersection_point = (a + b) / 2;
399
-
if (LinearAlg2D::getDist2FromLine(intersection_point, previous, current) > allowed_error_distance_squared
400
-
|| vSize2(intersection_point - previous) > smallest_line_segment_squared // The intersection point is way too far from the 'previous'
401
-
|| vSize2(intersection_point - next) > smallest_line_segment_squared) // and 'next' points, so it shouldn't replace 'current'
0 commit comments