Ordering boundary points obtained from Alpha shape

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Ordering boundary points obtained from Alpha shape

malcolm
Hi,
I am using Alpha Shape to get the boundary of a point collection - in my
case this is a 5x5 grid of evenly spaced points. This is my code:
/
void GetBoundaryPoints(const vector<CGAL_Point>& pts, vector<CGAL_Point>&
boundaryPts)
{
        Alpha_shape_2 alphaShape(pts.begin(), pts.end(),
                FT(10000),
                Alpha_shape_2::GENERAL);

        auto it = alphaShape.Alpha_shape_vertices_begin(),
                end = alphaShape.Alpha_shape_vertices_end();

        boundaryPts.clear();
        for (; it != end; ++it)
        {
                boundaryPts.push_back((*it)->point());
        }
}/

The boundary points are obtained correctly but not in a regular order -
clockwise or anticlockwise. Is there a way to do this?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Ordering boundary points obtained from Alpha shape

malcolm
Bumping this up. Any suggestions?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Ordering boundary points obtained from Alpha shape

MaelRL
In reply to this post by malcolm
Hello,

The key to achieve this will be to use the "classify" functions of the
alpha shape. Once you have found an edge with a face inside and a face
outside, you can walk in a clockwise manner around the target of the
edge, ignoring edges that have two outside faces until you meet a border
edge again.

Note that if you are using the 'GENERAL' mode, you can have "dangling"
edges that are part of the alpha shape but such that neither incident
face is part of the alpha shape so the walk above can be a little bit
more tricky.

Best,
Mael

On 05/09/2019 13:06, malcolm wrote:

> Hi,
> I am using Alpha Shape to get the boundary of a point collection - in my
> case this is a 5x5 grid of evenly spaced points. This is my code:
> /
> void GetBoundaryPoints(const vector<CGAL_Point>& pts, vector<CGAL_Point>&
> boundaryPts)
> {
> Alpha_shape_2 alphaShape(pts.begin(), pts.end(),
> FT(10000),
> Alpha_shape_2::GENERAL);
>
> auto it = alphaShape.Alpha_shape_vertices_begin(),
> end = alphaShape.Alpha_shape_vertices_end();
>
> boundaryPts.clear();
> for (; it != end; ++it)
> {
> boundaryPts.push_back((*it)->point());
> }
> }/
>
> The boundary points are obtained correctly but not in a regular order -
> clockwise or anticlockwise. Is there a way to do this?
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Ordering boundary points obtained from Alpha shape

malcolm
Thanks, Mael. This sounds good.
I chose a different method to get the boundary. This will be handy if I have
any change in the requirements.



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss