Boost logo

Boost Users :

Subject: Re: [Boost-users] measuring distance between a point and a segment
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2016-04-21 10:36:55


Juliette Pera wrote:
> Actually it was for point inside the polygon so it explains the problem.
>
> But can I access the elements of the polygon if I declare it as ring?
>

Of course, bg::model::ring is adapted to Boost.Range concept and also
has operator[]. If you had your own Ring type you could use any methods
defined in it. E.g. in my eariler email if you adapted
std::vector<Eigen::Vector2d> to a Ring concept you could of still call
any method and operator defined in std::vector.

>
> Then I can use the distance between the point and each segment to
> finally take the smallest value.
>

My point was that maybe you could avoid doing it manually. I don't know
what you're planning to do exactly but since you're ignoring the
interior of a Polygon when calculating distance then maybe a Linestring
would be a better representation? You could e.g. use
bg::model::linestring<Point>.

Regards,
Adam



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net