Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Alpha Shape 2D: Input point index

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Alpha Shape 2D: Input point index


Chronological Thread 
  • From: morrischen2008 <>
  • To:
  • Subject: Re: [cgal-discuss] Alpha Shape 2D: Input point index
  • Date: Fri, 30 May 2014 10:44:33 -0700 (PDT)

Thanks a lot Sebastien. Your advice works.

Following your advice [1], I successfully created the Delaunay triangulation with "index inserted in the vertices".

However, I failed to use the established Delaunay triangulation to build the alpha shape [3].

Here is how I did it.

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef CGAL::Triangulation_vertex_base_with_info_2<unsigned, K> Vb;
typedef CGAL::Triangulation_data_structure_2<Vb,> Tds;
typedef CGAL::Delaunay_triangulation_2<K, Tds> Delaunay_2;
typedef CGAL::Alpha_shape_2<Delaunay>  Alpha_shape_2;
 
Delaunay_2 T;
T.insert(points.begin(), points.end()); // Compile and runs fine until now
Alpha_shape_2 A(T); // compiler gives lots of errors!!!


Previously when I just used a bunch of points to construct alpha shape it works fine, like this:


typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef CGAL::Alpha_shape_vertex_base_2<K> Vb;
typedef CGAL::Alpha_shape_face_base_2<K>  Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_2<K,Tds> Triangulation_2;
typedef CGAL::Alpha_shape_2<Triangulation_2>  Alpha_shape_2;

Alpha_shape_2 A(input.begin(), input.end()); // Works fine

Any advice to get rid of the compiler errror? I will highly appreciate it. Thanks.





On Thu, May 29, 2014 at 1:09 AM, Sebastien Loriot (GeometryFactory) [via cgal-discuss] <[hidden email]> wrote:
You can try to build the triangulation (with simplex types suited for
the Alpha-shape of course) like in this example [1] or any
"insert_with_info*" example [2].
Then you can build the alpha shape from the triangulation [3].

Sebastien.

[1]
http://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2info_insert_with_pair_iterator_2_8cpp-example.html
[2] http://doc.cgal.org/latest/Triangulation_2/examples.html
[3]
http://doc.cgal.org/latest/Alpha_shapes_2/classCGAL_1_1Alpha__shape__2.html#a9d026da2568aed80884a5053bae0039b
On 05/28/2014 09:24 PM, morrischen2008 wrote:

> Hi everyone,
>
> I am currently using Alpha Shape to construct the surface of a bunch of
> points. The process is simple: the input is a bunch of points, and I get a
> bunch of points as output. However, when I have indexes for the input
> points, like this
>
> input
> ---------------
> index  location
> 1       (1.0, 2.0)
> 2       (2.1, 2.3)
> 3       (2.3, 1.8)
> .             ...
> .             ...
> 731   (7.1, 9.3)
> .             ...
>
> I want to have to get, in the output points, also the indexes, like this
>
> output
> ------------------
> index    location
> 2          (2.1, 2.3)
> .                 ...
> .                 ...
> 333      (3.5, 7.8)
> .                ...
>
> However, I do not know how to obtain the indexes in outputs. Anyone here can
> help me with this? I will appreciate your kind help. Below is how I obtain
> the output points.
>
> First, use the constructor
>
> Alpha_shape_2 A(input.begin(), input.end(), FT(0.0001));
>
> , while "input" is  a "list<Point_2>".
>
> The output I can obtain from "A" is a bunch of points, by using the
> iterators (I know I can also get a bunch of "Segment_2 as outputs as well"),
> like this
>
> for(Alpha_shape_vertices_iterator it =  A.alpha_shape_vertices_begin();
>        it != A.alpha_shape_vertices_end();
>        ++it) {
>      Vertex_handle vh = *it;
>      Point_2 p(vh->point().x(), vh->point().y());
>      output.push_back(p);
> }
>
> , while "output" is a "vector<Point_2>".
>
>
>
> --
> View this message in context: http://cgal-discuss.949826.n4.nabble.com/Alpha-Shape-2D-Input-point-index-tp4659360.html
> Sent from the cgal-discuss mailing list archive at 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





If you reply to this email, your message will be added to the discussion below:
http://cgal-discuss.949826.n4.nabble.com/Alpha-Shape-2D-Input-point-index-tp4659360p4659362.html
To unsubscribe from Alpha Shape 2D: Input point index, click here.
NAML



--
Morris


View this message in context: Re: Alpha Shape 2D: Input point index
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page