Reputation: 19
Recently I am on a project to calculate distance between various geometries, eg a polygon to polygon, ring to ring.
Now I have some questions:
When define a polygon or a ring, I need to append the exactly first point to the defiened polygon to make them enclosed? (I have seen some examples like this)
When calculate distance, it always calculate a point to points of another geometry? It could be linestring or something others?
Upvotes: 1
Views: 638
Reputation: 393134
It all depends on the parameterization of your models. Specifcally you can configure the orientation (CW/CCW) and openness (open/closed) of your Ring type.
As far as the algorithms go, the documentation lists what concepts are suited: https://www.boost.org/doc/libs/1_69_0/libs/geometry/doc/html/geometry/reference/algorithms/distance/distance_2.html#geometry.reference.algorithms.distance.distance_2.supported_geometries.
Pro tip:
Use bg::is_valid
and or bg::correct
to automatically fix common issues (like unclosed polygons)
Upvotes: 2