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
For example this input: MULTIPOLYGON(((2 8,2 9,3 8,2 8)),((4 6,4 7,5 6,4 6)),((4 2,5 2,4 1,4 2)))
(as in recursive_polygons_buffer.cpp, with distance 1.0 and miter)
Delivers a buffer which is incorrect.
After some debugging it is caused by ( in get_turn_info):
if (dir_info.arrival[i] == 1)
{
// The segment arrives at the intersection point, its fraction should be 1
// (due to precision it might be nearly so, but not completely, in rare cases)
ti.operations[i].fraction = {1, 1};
}
else if (dir_info.arrival[i] == -1)
{
// The segment leaves from the intersection point, likewise its fraction should be 0
ti.operations[i].fraction = {0, 1};
}
But if segments are nearly collinear, and touch at the end, the arrival info can apparently not be trusted. This should go or should be changed.
Because if arrival is 1, the fraction is {1,1}, meaning: at the end - but the point is not at the end of the segment. That causes wrong sorting along the ring. The current algorithm can sometimes cope with it, sometimes not (in the reported case: not). The sorting should always be correct. And even if the sorting is still correct - the fractions should be correct.
Turn 0 and 2 above are both on segment 4 and having the same fraction information (dst). That would mean they are colocated. This is wrong. Correction gives:
For example this input:
MULTIPOLYGON(((2 8,2 9,3 8,2 8)),((4 6,4 7,5 6,4 6)),((4 2,5 2,4 1,4 2)))
(as in
recursive_polygons_buffer.cpp
, with distance1.0
andmiter
)Delivers a buffer which is incorrect.
After some debugging it is caused by ( in
get_turn_info
):But if segments are nearly collinear, and touch at the end, the arrival info can apparently not be trusted. This should go or should be changed.
Because if
arrival
is1
, the fraction is{1,1}
, meaning: at the end - but the point is not at the end of the segment. That causes wrong sorting along the ring. The current algorithm can sometimes cope with it, sometimes not (in the reported case: not). The sorting should always be correct. And even if the sorting is still correct - the fractions should be correct.The wrong fractions in the case above:
Turn 0 and 2 above are both on segment 4 and having the same fraction information (
dst
). That would mean they are colocated. This is wrong. Correction gives:An example of the wrong sorting:
The turns (5,1) part of cluster 1 should be sorted consecutively along a ring, it cannot be that there is another turn in between.
Just removing the code above gives correct results, and apparently no regressions. To be checked further.
The text was updated successfully, but these errors were encountered: