Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Add information in Triangulation while inserting a range of points

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Add information in Triangulation while inserting a range of points


Chronological Thread 
  • From: Mael <>
  • To:
  • Subject: Re: [cgal-discuss] Add information in Triangulation while inserting a range of points
  • Date: Mon, 13 May 2019 08:22:46 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:gjU3AxdTONOGfNFmMV7JuC29lGMj4u6mDksu8pMizoh2WeGdxcSyZh7h7PlgxGXEQZ/co6odzbaP6uaxAidZuc/JmUtBWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MQi6oR/Vu8QYjoduN7o9xgbUqXZUZupawn9lK0iOlBjm/Mew+5Bj8yVUu/0/8sNLTLv3caclQ7FGFToqK2866tHluhnFVguP+2ATUn4KnRpSAgjK9w/1U5HsuSbnrOV92S2aPcrrTbAoXDmp8qlmRAP0hCoBKjU09nzchM5tg6JBuB+vugJxw4DUbo+WOvRxcKzSctEGSmRORctRSy9MD5mgY4cTAecMP+BVpJT9qVsUqhu+ABGhCuT1xTBWgn/9wKo30+E7Hg7Y2AwsBcgOsHPJrNT6KqgSVfq5zK3SwjrYdPxZxyzw6IfWfRAmpPGDQ65wcdDRyEkhDQzKkkmQqYv/PzKVzOgCr2+b7+95WO+plmUppQZxoj21ycctjInEnoQVxUrf+ipixIY6O8e0R1J8Yd6hCJdQuCCaN5d2QsM/WG5kojo1yroDuZKjYCcKx44oxxrFZ/yAaYiI7RTuX/uSLzdgnH9od7Oyiwyv/US8yuDwTMu53VdQoiZbk9TArnQA2wDJ5sWES/Zx5Fqt1DKL2gzJ9+1JL045mKzGIJA72LEwjIAcsUHbEy/2hkr2iKiWe10r9+Sy7uTnZajqqoWZN4BuiwH+Nr0imsuiAeQkKAQOWHab+eSm2L3l40L5XK1GjvwwkqbHrJDXPcsWq6+jDwNIzoou6wyzAjWn3dgCg3UKLUpJeBedgIjoP1HOLur4DfC6g1m0lTdk3e7JPrn7DpXXKXjDjbjgcqh560JGzAo818tQ6IlKBbwaL/L8REjxtNnGAR8lKQy1w+jnB89h2YMCXmKPGK+YPLnOvl+P4+IjO/OMa5MNuDbhN/gl4ObjgmM2mVAHeamlxIYYaHGjHvt6PkWZemHsj8waEWYKuwo+VPblhEeDUT5VfXayXrgz6is1CIK8Xs//QdWmj7WFmSu6BZZLfXtuC1aWEH6ueZ/Xde0LbXe3K8Jl2mgBXLWlDZUmyAGjsEn+wrBtI8Lb9yoduI75xdZ87PHUjwB0/jtxWZfOm1qRRn15yztbDwQ927py9BQklgWzlJNgivkdLuR9outTW11jZ5HRyOl3F8rjVAvKYtCTWRCtRdD0WWhsHOJ0+McHZgNGI/vnjh3H2HD2UeNTkrvSQpk986aZ2GXtYcFjyzDA2bVz1wB3EPsKDnWvg+tEzyaWAofIl0uDkKPwLPYT0SnI+XuZ3GSHt11fSh82WqLADygS

Hello,

Insertion of a range of points is basically the insertion of points one-by-one, except that points are sorted before. Thus, if you're not inserting a lot of points, the spatial sorting of points will not make a big difference, and you can simply do something like

for(const My_point_with_info& pt : my_pts)
{
  vertex_handle vh = tr.insert(pt.point());
  vh->info() = pt.info();
}

and you're done.

If you're going to insert a lot of points, you can simply copy the function that inserts a range with info from DT3 or RT3 (https://github.com/CGAL/cgal/blob/master/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h#L431) into Triangulation_3.h and it should work almost out of the box.

Best,
Mael

On 13/05/2019 04:25, sanlingtonCGAL wrote:
Hi,

I know the Delaunay and Regular triangulation in CGAL can already add
information to vertices while inserting /a range of points/, as introduced
in
https://doc.cgal.org/latest/Triangulation_3/index.html#Triangulation_3Delaunay

But it seems that the Triangulation_2/3 (not Delaunay triangulation or
Regular triangulation) can't do that, am I correct?

What I want to do is to construct Triangulation by inserting a range of
points, and each point or vertex would carry extra information, like an
index.
I am using codes like:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h>
#include <CGAL/Triangulation_cell_base_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<unsigned, K> Vb;
typedef CGAL::Triangulation_cell_base_3<K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
//Use the Fast_location tag. Default or Compact_location works too.
typedef CGAL::Triangulation_3<K, Tds> Triangulation;
typedef Triangulation::Point
Point;
int main()
{
std::vector< std::pair<Point, unsigned> > points;
points.push_back(std::make_pair(Point(0, 0, 0), 0));
points.push_back(std::make_pair(Point(1, 0, 0), 1));
points.push_back(std::make_pair(Point(0, 1, 0), 2));
points.push_back(std::make_pair(Point(0, 0, 1), 3));
points.push_back(std::make_pair(Point(2, 2, 2), 4));
points.push_back(std::make_pair(Point(-1, 0, 1), 5));

Triangulation T(points.begin(), points.end());
CGAL_assertion(T.number_of_vertices() == 6);

return 0;
}

The above codes are similar to those in the manual document, I just replaced
the Delaunay with Triangulation. But the compiler gave me errors like:

c:\program files (x86)\microsoft visual
studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(881): error
C2664: 'CGAL::Point_3<Kernel_>::Point_3(CGAL::Point_3<Kernel_> &&)': cannot
convert argument 1 from '_Ty' to 'const CGAL::Origin &'
1> with
1> [
1> Kernel_=CGAL::Epick
1> ]
1> and
1> [
1> _Ty=std::pair<Point,unsigned int>
1> ]
1>c:\program files (x86)\microsoft visual
studio\2017\community\vc\tools\msvc\14.16.27023\include\xmemory0(879): note:
Reason: cannot convert from '_Ty' to 'const CGAL::Origin'
1> with
1> [
1> _Ty=std::pair<Point,unsigned int>
1> ]


What should I do to add information to point/vertex of a Triangulation while
inserting a range of points?

Thank you.





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




Archive powered by MHonArc 2.6.18.

Top of Page