Opened 9 years ago

Last modified 9 years ago

#3264 new defect

Spurious edges in ST_ApproximateMedialAxis

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS SFCGAL
Component: postgis Version: master
Keywords: Cc:

Description

When edges of a polygon are nearly collinear there are more edges than expected in the output of ST_ApproximateMedialAxis.

Attachments (1)

robustness2.png (17.5 KB ) - added by strk 9 years ago.

Download all attachments as: .zip

Change History (7)

by strk, 9 years ago

Attachment: robustness2.png added

comment:2 by strk, 9 years ago

Pre-simplifying the input seems to work fine, it's just a matter of finding a good tolerance value (not so easy).

comment:3 by vmo, 9 years ago

Maybe checking the result would be better/easier to find a good tolerance.

The medial axis points should all be at the same distance from the contour, so checking the distance of Approx Medial Axis segments ends and middle would provide a metric of the quality (min/max ~ 1, looking at the picture it would be ~ .5).

comment:4 by strk, 9 years ago

Pre-simplifying input to skeletin is suggested as being a good idea by Fernando Cacciola of CGAL: https://github.com/CGAL/cgal/issues/123#issuecomment-112911320

Distance from the contour is not constant: the data I'm using is about rivers and along this specific river there are legit medial axis that are 1mt away from border while the offending one in the picture is 10mt away (so the local area shown in picture would have an average of 20mt distance).

comment:5 by strk, 9 years ago

Here's the WKT of test polygon (reduced):

POLYGON((1869500 5542134.04114701,1869542.48691877 5542117.03445929,
1869563.45884117 5542096.25547497,1869565.09977432 5542094.62476936,
1869605.02746282 5541987.27322033,1869615.07355377 5541948,
1869583.08175414 5541948,1869578.6141196 5541967.06067625,
1869553.09669917 5542031.99177998,1869527.78084588 5542076.81267058,
1869505.06812083 5542096.72108973,1869500 5542099.06878245,
1869500 5542134.04114701))

After trying a simplify with a tolerance based on perimeter, which works very badly for this reduced case, I think I understood what Vincent was saying and I'm going to try that. Vincent, you meant the difference of the distance between each of the 2 skeleton edge endpoints and the boundary of the polygon, right ?

comment:6 by strk, 9 years ago

Milestone: PostGIS 2.2.0PostGIS SFCGAL
Note: See TracTickets for help on using tickets.