Subject: CGAL users discussion list
List archive
- From: malcolm <>
- To:
- Subject: [cgal-discuss] Add vertex info before inserting constraints
- Date: Fri, 12 Apr 2019 02:08:21 -0500 (CDT)
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Fail ; spf=Pass
- Ironport-phdr: 9a23:XOcKxB/Nmg2UgP9uRHKM819IXTAuvvDOBiVQ1KB42u8cTK2v8tzYMVDF4r011RmVBNydsaoP0rOM++C4ACpcuM7H6ChDOLV3FDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3OgV6PPn6FZDPhMqrye+y54fTYwJVjzahfL9+Nhq7oRjMusUMn4duNqk9xgbUrndWZu9awX9kKU+Jkxvz+8u84IRv/zhMt/4k6sVNTbj0c6MkQLJCET8oKXo15MrltRnCSQuA+H4RWXgInxRLHgbI8gj0Uo/+vSXmuOV93jKaPdDtQrAvRTui9aZrRwT2hyoBKjU07XvYis10jKJcvRKhuxlyyJPabY2JKPZzeL7WcNUHTmRDQ8lRTTRMDI28YYURDOQPIOlXoJXyqVYVsRuzBxWgCP/zxjNUmHP727Ax3eQ7EQHB2QwtB9cOv27QrNrpM6cSVeW1x7TPwDXGdfxW3Svy6I/MchAku/2DQah/cdDPyUY1EwPFjlKQpJf5MDyPy+QNqHaU7uR6WuOvkWIotwZxoj22y8oql4LHiIUVylXe+iV4xoY4Pdu4R1RgbtG/FJtfqTuWOJdxQsMnRWxjpSU0yqUetJKmeCUHzI4ryhDcZvCdcIWF4wjvWeeQLDp+mXlrYqiwhwyo/kil0uD8Vte70FJNriddlNnBuWoB1xrJ5cecUfR9+lmu1SyT2ADU7+FIOUE0lazFJJ492rM8i54evEDZEiL4m0j6lqybe0Q+9uWp6unrerDmqYWdN49whAH+KKMumsmnDOQ9KAcOW3SU+eO41L3m50H2XK9FjucokqbDtJDaJcMbq7WlDABPz4Yj8AiwDjm839UYh3UIMFVFeBefg4jzJ17OOOz4Deu4g1m0jDhryOrJPrn4DprQL3jDi6vufatm605H0wcz1tBe55dMCr4bOv7zW0nxtMbZDhAjKQC0zfznW51B0dYVVmuLR6OYK6jPqkSg5+Q1IuDKapVGliz6Lq0g7vrlins80QsYdK2i2p8SLnuxBOpvJ0WeSXHln8wMDm4b+AE5Sbq52xW5TTdPaiPqDOoH7TYhBdf+VNuRdsWWmLWEmRyDMNhOfGkfVgKHGGrzepqNSrEHbyfAepYwwAxBbqCoTsoa7T/rsQb7z7R9Ke+Npn8TvI/42cd89qvYkhRgqWUpXfTY6HmESiRPpk1NRzIy2/ki80ohjFGK26J8jrpTEtkBvv4=
Hi,
I am using the Constrained_Delaunay_triangulation_2 class. I want to attach
vertex info to the constraint vertices before calling insert_constraint, in
the same way as I can add info to vertices before inserting in a
triangulation. I cannot find a CGAL method to do this. Here's my code
#include <CGAL\Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <vector>
class VertexInfo
{
public:
double data;
int index;
VertexInfo() {}
VertexInfo(double e, int i)
:data(e), index(i) {}
};
typedef CGAL::Exact_predicates_inexact_constructions_kernel
Kernel;
typedef CGAL::Exact_predicates_tag
Itag;
typedef CGAL::Triangulation_vertex_base_with_info_2<VertexInfo, Kernel> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<Kernel>
Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb>
Tds;
typedef CGAL::Constrained_Delaunay_triangulation_2<Kernel, Tds, Itag>
Delaunay;
typedef Kernel::Point_2
CGAL_Point;
int main()
{
Delaunay T;
std::vector< std::pair<CGAL_Point, VertexInfo> > points;
points.push_back(std::make_pair(CGAL_Point(0.123456789, 0),
VertexInfo(0.3,
-1)));
points.push_back(std::make_pair(CGAL_Point(1, 0), VertexInfo(0.5,
-1)));
points.push_back(std::make_pair(CGAL_Point(0, 1), VertexInfo(1.3,
-1)));
points.push_back(std::make_pair(CGAL_Point(1, 1), VertexInfo(0.8,
-1)));
points.push_back(std::make_pair(CGAL_Point(2, 2), VertexInfo(0.3,
-1)));
// Triangulate
T.insert(points.begin(), points.end());
std::vector< std::pair<CGAL_Point, VertexInfo> > constraintPts;
constraintPts.push_back(std::make_pair(CGAL_Point(10, 10),
VertexInfo(1.3,
0)));
// how do I add constraints with vertex just like above?
T.insert_constraint(constraintPts.begin(), constraintPts.end()); //
this
gives a compiler error
return 0;
}
If this is not possible, I would like to get the vertex handles of the
constrained vertices and then attach the vertex info to each vertex. Is this
possible?
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/
- [cgal-discuss] Add vertex info before inserting constraints, malcolm, 04/12/2019
- Re: [cgal-discuss] Add vertex info before inserting constraints, Marsh, Chris, 04/12/2019
- Re: [cgal-discuss] Add vertex info before inserting constraints, malcolm, 04/15/2019
- Re: [cgal-discuss] Add vertex info before inserting constraints, Marsh, Chris, 04/12/2019
Archive powered by MHonArc 2.6.18.