Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Marking the outer vertices of a triangulation with alpha shape

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Marking the outer vertices of a triangulation with alpha shape


Chronological Thread 
  • From: Daniel Duque <>
  • To: cgal-discuss <>
  • Subject: Re: [cgal-discuss] Marking the outer vertices of a triangulation with alpha shape
  • Date: Mon, 27 Jul 2015 22:31:38 -0400

Hello Sebastien.

I thought "dt" would be destroyed. This will almost certainly solve the issue, since I can mark the vertices on "as", then this info will be transferred onto "dt".

Thanks a lot,

Daniel


On Mon, Jul 27, 2015 at 12:17 PM, Sebastien Loriot (GeometryFactory) <> wrote:
It does not destroy your triangulation, it simply takes the ownership.
When you're done with the Alpha_shape_2, you can swap [1] it back to your original triangulation or directly use it as a triangulation.

Something like the following should work:
Dt dt;
Alpha_shape as(dt);
static_cast<Dt&>(as).swap(dt); // the alpha-shape is no longer valid


Sebastien

[1] http://doc.cgal.org/latest/Triangulation_2/classCGAL_1_1Triangulation__2.html#a1788d6ffa3f5986b2b07e7e0b48a2ffc

On 07/27/2015 04:30 PM, Daniel Duque wrote:
Thanks Sebastien.

I fact, I do have info on the vertices, e.g the bool variable that marks
a vertex as being inner or outer and lots of other stuff. That info gets
copied correctly on the new T2 triangulation, but the latter is
destroyed when building the alpha shape. My problem is then either to
transfer back the info to the original T triangulation (which I do, but
in a manner which is not too efficient), or perhaps stopping the alpha
shape constructor from destroying my triangulation.

I have just noticed there is another way to create an alpha shape, from
a list of points:

http://doc.cgal.org/latest/Alpha_shapes_2/classCGAL_1_1Alpha__shape__2.html#a5524e49e27ef267165673d0a36bddb14

If I could make an alpha shape from a list of pair< points, vertex
handle >, I guess I could retrieve the vertex from which each of the
points came from...

Best,

Daniel


On Mon, Jul 27, 2015 at 1:28 AM, Sebastien Loriot (GeometryFactory)
< <mailto:>> wrote:

    What about adding an info in the vertex type?

    See this example:
    http://doc.cgal.org/latest/Triangulation_2/index.html#title40
    using this class:
    http://doc.cgal.org/latest/Triangulation_2/classCGAL_1_1Triangulation__vertex__base__with__info__2.html

    Sebastien.


    On 07/24/2015 05:40 PM, Daniel Duque wrote:

        Hello everyone.

        I have been using alpha shapes to identify the outer vertices of
        triangulations
        for some time, and I am very happy with the method. However, the
        underlying triangulation
        is destroyed in the process. This often OK, but can be
        inconvenient if
        one just wants to "mark"
        the nodes as outer, but keeping the triangulation. Right now I
        am doing
        this crude treatment
        which, as you see, copies the triangulation, destroys it, then
        marks the
        vertices on the original
        triangulation as outer if the coincide with the nodes of the
        alpha shape.

        The crudest part, as you can see, is that this coincidence is
        implemented by "locate", since
        I have lost any other connection with the original triangulation. I
        guess I could hack the
        copy procedure in order to include a pointer or handle to the
        original
        one...

        Any ideas will be welcome.

        Best,

        Daniel Duque
        UPM

        // T is a global Delaunay triangulation

        void surf_detect(void) {

            Triangulation T2(T);

            FT hh= 1.2 * simu.h();

            FT alpha=hh*hh;
            Alpha_shape_2 al( T2, alpha );

            for (Alpha_shape_vertices_iterator
        asv=al.alpha_shape_vertices_begin();
                 asv!=al.alpha_shape_vertices_end();
                 ++asv) {

              Point p=(*asv)->point();

        //  mark vertices in the alpha shape as boundary vertices
        //  implemented by locate (not very efficient, I guess)

              int i;
              Triangulation::Locate_type lt;
              Face_handle fc=T.locate(p, lt , i );
              fc->vertex(i)->boundary.set( true );
            }

            return;
        }



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





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






Archive powered by MHonArc 2.6.18.

Top of Page