CGAL Question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CGAL Question

Ro Ly
Hello!

First of all, I would like to know what should I do to intersect a polyhedron wth a plane. 

Then, how to do a 2D triangulation of this intersection's result.

Thank you very much.
Reply | Threaded
Open this post in threaded view
|

Re: CGAL Question

Sebastien Loriot (GeometryFactory)
On 03/04/2018 07:57 PM, Ro Ly wrote:
> Hello!
>
> First of all, I would like to know what should I do to intersect a
> polyhedron wth a plane.

This can be done using Polygon_mesh_slicer:
https://doc.cgal.org/latest/Polygon_mesh_processing/classCGAL_1_1Polygon__mesh__slicer.html

>
> Then, how to do a 2D triangulation of this intersection's result.

Using the output polylines you can use the 2D constrained Delaunay
triangulation to compute a triangulation of the domain:

https://doc.cgal.org/latest/Triangulation_2/classCGAL_1_1Constrained__Delaunay__triangulation__2.html

You'll need a specific traits class to handle 3D points.
If you are using axis orthogonal planes you can use a projection traits:
https://doc.cgal.org/latest/Kernel_23/classCGAL_1_1Projection__traits__xy__3.html

Or more generally the undocumented traits
Triangulation_2_projection_traits_3 defined in
CGAL/Triangulation_2_projection_traits_3.h

Something like the following should be working:

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_2_projection_traits_3<K>   P_traits;
typedef CGAL::Triangulation_vertex_base_2<P_traits>        Vb;
typedef CGAL::Constrained_triangulation_face_base_2<P_traits>   Fb;
typedef CGAL::Triangulation_data_structure_2<Vb,Fb> TDS;
typedef CGAL::No_intersections_tag  Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
                                                      TDS,
                                                      Itag> CDT;

K::Vector_3 normal = ... // plane normal
P_traits cdt_traits(normal);
CDT cdt(cdt_traits);

Sebastien.

>
> Thank you very much.

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss