Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Add information in Triangulation while inserting a range of points
Chronological Thread
- From: Marc Alexa <>
- To:
- Subject: Re: [cgal-discuss] Add information in Triangulation while inserting a range of points
- Date: Mon, 13 May 2019 09:01:24 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:g8hxRxOIdkU1A2jcVqkl6mtUPXoX/o7sNwtQ0KIMzox0Ivv5rarrMEGX3/hxlliBBdydt6sdzbuN+Pm4CCQp2tWoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7Ovr6GpLIj8Swyuu+54Dfbx9HiTagfL9+NhG7oAveusULnYdvLrs6xwfUrHdPZ+lY335jK0iJnxb76Mew/Zpj/DpVtvk86cNOUrj0crohQ7BAAzsoL2465MvwtRneVgSP/WcTUn8XkhVTHQfI6gzxU4rrvSv7sup93zSaPdHzQLspVzmu87tnRRn1gyoBKjU38nzYitZogaxbvB2uqAFxzYDaYI+LNvVwfaTTcMgASmZdW8ZcTSxBDp++YoYJEuEPPfxYr474p1YWqhWxHxOsC//ywTJUgn/5w6I73P48GgzB2QwvBcgOv2jOoNrvMKcdT++0w7PTwDXMavNZwzb96IzSfh89pvGMWKt9fMzMwkchEAPFi0+fqY3jPz6N0OQCqXOU4PFkVe2xkWIotwZxoj23ysctjInJnIMVxUre+SV32oY5PcG3SEFhbt6gCpdQsDuaN4RwT8g/QG9ooD43xqMatZO/ZiQHy5QqywTBZ/CbcIWE+BLuWPqJLTtlin9pZKiziwu9/EWk0OHwS8u53EhQoiZYj9XBtnYA3AHJ5MedUPty5EKh1C6P1w/N7uFEJlg5la/BJJ4gxr48j4QcvlneEiPvlkX7jLOael8r+uiv7OTnbbHmqYGGO4BojQH+N7wims25AesmLggDR3aX9fi42bH5/kD0QK9GguMqnqTaqpzXJdgXqra8AwBP04Yj7xi/Dy2h0NQdhXQHKUhKeAibgITzIV7OJO73DPiljFm3nzdrwurJPrzlApnXMnfDl7Lhca5n60FA0Aoz0cxf55VMB74dL/L8QEvxuMXFAR84KAy73/vnCM5m1o4FQmKOAqqZMLvIvlOS5+IvJfOMZI4PtzrnJfgl/a2msHkihFVIfbW1xYBFLzejD/F+KgOYZ2Dti5EPCyARrw8mRavrjlOFFjVcbnL3U6Mn7SwgE9GaCtLISYmpxbCAxyymBYZ+Z2ZcC1nKH227WZ+DXqIpYTiZauZlnywNHeykQpUqkxiquR/z47ViJ+vQvCYfsMSwh5BO++TPmERqpnRPBMOH3jTVFjAmriYzXzYzmZtHjwl4w1aH37J/hqUBR9NW7vJNFAw9MMyFlrEoO5XJQgvEO+yxZhOmT9GhW2xjS9swx5oDbx84FYj6yB/E2CWuDvkekLnZXMVooJKZ5GD4IoNG81iDzLMo1gB0Tc5GNGngjal6pVDe
Yes, CGAL is sometimes mysterious in what types are accepted by what functions. I agree you’d expect that the insert method for Triangulation_3 should be able to understand how to handle the pairs if Delaunay_triangulation_3 does. But, no. If you insist on using the pairs and are ok with initially getting a Delaunay triangulation, the following code works just fine:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h>
#include <CGAL/Delaunay_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 CGAL::Delaunay_triangulation_3<K, Tds> DT;
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 = DT(points.begin(), points.end());
CGAL_assertion(T.number_of_vertices() == 6);
return 0;
}
I believe speed-wise there is very little to be gained from not using Delaunay. If you don’t care about what coordinate in space carries which number, you could insert the range of points first and then set the info later. In this case, however, the order of the points you get form the vertex iterator will likely differ from the order in which you provided the points.
-Marc
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/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Add information in Triangulation while inserting a range of points, sanlingtonCGAL, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Mael, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Marc Alexa, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Andreas Fabri, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Andreas Fabri, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Marc Alexa, 05/15/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Mael, 05/15/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Laurent Rineau (CGAL/GeometryFactory), 05/15/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Mael, 05/15/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Marc Alexa, 05/15/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Andreas Fabri, 05/13/2019
- Re: [cgal-discuss] Add information in Triangulation while inserting a range of points, Andreas Fabri, 05/13/2019
Archive powered by MHonArc 2.6.18.