Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Is the following CDT buggy?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Is the following CDT buggy?


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Is the following CDT buggy?
  • Date: Mon, 14 Mar 2022 12:46:46 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-data: A9a23:+N8L/aCKrqCK8RVW/57lw5YqxClBgxIJ4kV8jS/XYbTApDhwgT0Py TYZDD3SaPfZYGajc9onatyw80gAvp/cyIcwOVdlrnsFo1Bi+ZOUX4zBRqvTF3rPdZObFBoPA +E2MISowBUcFyeEzvuVGuG96yE6jMlkf5KkYAL+EnkZqTRMFWFw0XqPp8Zj2tQy2YPgX1vU0 T/Pi5S31GGNi2Yc3l08sPrrRCNH5JwebxtF1rCWTakjUG72zxH5PrpHTU2CByeQrr1vIwKPb 72rIIdVUY/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8A/+v5TCRYSVatYox67vekrk +5Wj8yhdSQwJJ+WnMtADzANRkmSPYUekFPGCSX5tMvOkRSAdnLtx7BpEV1wOpMYvOB6HQmi9 9RId3ZcPlba2LLwm+zTpupE3qzPKOHiOo8Ft3h7iz/QB+wnaZ/ORKDH+cVJ0j47msdUDLDVY M9xhT9HPEifP0YWYT/7Drojur2jwVPlegdDj3CHpYdsw1LrlCp+he2F3N39IITSGJQ9clyjj mnJ9mC8DhABP8GE0hKe43e0j6nOmzn6UcQcDtWFGuVC3RuWwTFNUVsTXFq/5P6klgi5RdIZL UEIksYzkUQs3GeZbOCnBCajmi6Vgj0FQegKF8JntCjYn8I4/D2lLmQDSzdAbvkvu8k3WSEm2 ze1czXBWWUHXFq9FSz1y1uEkd+hEXRIcjNSPUfoWSNZs4Wy8enfmzqVFo4LLUKjsjHiMR/Kq 9xghAwvgLN7YSUjifTjpQ6vb96Ej4XXQxQ64AiS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This should do it, although not yet elegant

https://gist.github.com/afabri/82e9680181eea814fb488f96ceca8c12


On 3/14/2022 12:09 PM, Bob Bill ( via cgal-discuss Mailing List) wrote:
Thanks Sebastien and Andreas,
I see what Andreas means, indeed if I modify my example accordingly and then call refine_Delaunay_mesh_2() I have the expected error " no member named 'set_in_domain'...".
I tried to adapt it by adding typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;  in place of  typedef CGAL::Constrained_triangulation_face_base_2<K,Fbb>    Fb, but I get an error "no member named 'info' in..." coming from the start->info(), so I don't really know how to adapt it in order to have both functions. 
Should I only change the typedefs?

Best, Bob
Il lunedì 14 marzo 2022, 08:59:26 CET, Andreas Fabri ha scritto:


Hello,

Note that write_VTU is documented in the  CGAL package 2D Conforming
Triangulations and Meshes.

When you call a function like refine_Delaunay_mesh()  you define the
domain (for example the interior
of your polygon, as a domain, otherwise the convex hull of the points is
the domain.

When you follow the example Sebastien just gave you  must adapt it, as
the Delaunay_mesh_face_base_2
class has a function to set the domain.

https://doc.cgal.org/latest/Mesh_2/classDelaunayMeshFaceBase__2.html#ac4a80317799961e7830b9690121d6bdc
Best,

Andreas


On 3/14/2022 8:40 AM, Sebastien Loriot ( via
cgal-discuss Mailing List) wrote:
> A triangulation of a point set is a triangulation of the convex hull
> of the points. If some constrain edges are added, you then have the
> guarantee that those edges will be present in the triangulation of the
> convex hull of your points.
>
> If your constraints define a closed shape then you need a flooding like
> algorithm to only pick the triangles that are inside the shape, like in
> this example:
>
> https://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2polygon_triangulation_8cpp-example.html
>
>
> Best,
>
> Sebastien.
>
> On 3/13/22 02:46, Bob Bill ( via cgal-discuss
> Mailing List) wrote:
>> I am given the vertices of a polygon, and I need to mesh it. I am
>> following one of the first examples in the CDT package documentation.
>>
>> The code is the following:
>>
>> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> >> #include <CGAL/Constrained_Delaunay_triangulation_2.h> >> #include <CGAL/Delaunay_mesher_2.h> >> #include <CGAL/Delaunay_mesh_face_base_2.h> >> #include <CGAL/Delaunay_mesh_size_criteria_2.h> >> #include <CGAL/IO/write_VTU.h> >>
>> #include <iostream>
>> typedef CGAL::Exact_predicates_inexact_constructions_kernel K; >> typedef CGAL::Triangulation_vertex_base_2<K> Vb; >> typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
>> typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds; >> typedef CGAL::Constrained_Delaunay_triangulation_2<K, Tds> CDT;
>> typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria; >> typedef CDT::Vertex_handle Vertex_handle; >> typedef CDT::Point Point;
>>
>> int main()
>> {
>>    CDT cdt;
>>    Vertex_handle va = cdt.insert(Point(-1,-1)); >>    Vertex_handle vb = cdt.insert(Point(-1,-0.25714));
>>    Vertex_handle vc = cdt.insert(Point(-1.5,-1.4));
>>    Vertex_handle vd = cdt.insert(Point(1.3,-1.2));
>>    Vertex_handle ve = cdt.insert(Point(1.3,0.5)); >>    Vertex_handle vf = cdt.insert(Point(1, 0.45714));
>>    Vertex_handle vg = cdt.insert(Point(1, -1)); >>
>>    cdt.insert_constraint(va, vb);
>>    cdt.insert_constraint(vb, vc);
>>    cdt.insert_constraint(vc, vd);
>>    cdt.insert_constraint(vd, ve);
>>    cdt.insert_constraint(ve,vf);
>>    cdt.insert_constraint(vf,vg);
>>    cdt.insert_constraint(vg,va);
>>    std::cout << "Number of vertices: " << cdt.number_of_vertices() << >> std::endl;
>>    std::cout << "Meshing the triangulation..." << std::endl;
>>    // CGAL::refine_Delaunay_mesh_2(cdt, Criteria(0.125, 0.5));
>>    std::cout << "Number of vertices: " << cdt.number_of_vertices() << >> std::endl;
>>
>>    std::ofstream output("intersected_mesh.vtu"); >>    CGAL::write_vtu(output, cdt);
>>
>> //Show the vertices of the triangulation >>      for(auto it =
>> cdt.finite_faces_begin();it!=cdt.finite_faces_end();++it){ >>      std::cout << cdt.triangle(it) <<'\n';
>>    }
>> }
>>
>> If I look at the .vtu file, it seems to have the correct shape (see
>> attached image). However, after I printed the vertices for each
>> triangle, it appears that one element of the triangulation is also
>> the one with vertices
>> (-1, -0.25714)
>> (1, -1)
>> (1, 0.45714)
>>
>> which should not be there since is not inside that polygon. Isn't
>> this a bug? If not, how can I create a mesh for which this is
>> avoided? I mean, I'd like to have all the triangles inside the domain.
>>
>> Best regards,
>> Bob
>>
>> --
>> You are currently subscribed to cgal-discuss. >> To unsubscribe or access the archives, go to >> https://sympa.inria.fr/sympa/info/cgal-discuss >>
>
--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project


--
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

-- 
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project



Archive powered by MHonArc 2.6.19+.

Top of Page