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 09:42:41


Juliette Pera wrote:
> Thank you very much it works very well now!
>
> I was considering using a ring type at first but I was having a wrong
> result too.
> I was using the /append/ function and then the /correct /one.
> Maybe I was missing something to "close" the polygon?
>

correct() should reverse and close the Ring for you if needed so it
probably wasn't it.
What was wrong with the result?
Have in mind that for Points contained inside a Ring the distance is 0.

You could debug your code and see if the data stored in your objects is
correct before passing it into an algorithm.
In order to debug Boost.Geometry conveniently you could use debugging
visualizers/helpers:

Visual Studio 2015:
https://visualstudiogallery.msdn.microsoft.com/4b81868b-8901-408f-a28e-25a6580788fb

Visual Studio 2012-13:
https://github.com/awulkiew/graphical-debugging/blob/master/Visual_Studio_2015/GraphicalDebugging/BoostGeometry.natvis
How to use it:
https://msdn.microsoft.com/en-us/library/jj620914%28v=vs.110%29.aspx

QtCreator:
https://github.com/awulkiew/debugging-helpers

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