CGAL 5.2.1 - 3D Boolean Operations on Nef Polyhedra

Functions

template<class Nef_polyhedron , class Polygon_mesh >
void CGAL::convert_nef_polyhedron_to_polygon_mesh (const Nef_polyhedron &nef, Polygon_mesh &pm, bool triangulate_all_faces=false)
 Converts an objet of type Nef_polyhedron_3 into a polygon mesh model of MutableFaceGraph. More...
 
template<class Nef_polyhedron , typename PolygonRange , typename PointRange >
void CGAL::convert_nef_polyhedron_to_polygon_soup (const Nef_polyhedron &nef, PointRange &points, PolygonRange &polygons, bool triangulate_all_faces=false)
 Converts an objet of type Nef_polyhedron_3 into a polygon soup. More...
 
template<class Traits >
istream & CGAL::operator>> (std::istream &in, CGAL::Nef_polyhedron_3< Traits > &N)
 This operator reads a Nef polyhedron, which is given in the proprietary file format written by the input operator in and assigns it to N. More...
 
template<class Traits >
ostream & CGAL::operator<< (std::ostream &out, CGAL::Nef_polyhedron_3< Traits > &N)
 This operator writes the Nef polyhedron N to the output stream out using a proprietary file format. More...
 
template<class Nef_polyhedron_3 >
std::size_t CGAL::OFF_to_nef_3 (std::istream &in, Nef_polyhedron_3 &N)
 This function creates a 3D Nef polyhedron from an OFF file which is read from input stream in. More...
 

Function Documentation

◆ convert_nef_polyhedron_to_polygon_mesh()

template<class Nef_polyhedron , class Polygon_mesh >
void CGAL::convert_nef_polyhedron_to_polygon_mesh ( const Nef_polyhedron &  nef,
Polygon_mesh &  pm,
bool  triangulate_all_faces = false 
)

#include <CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h>

Converts an objet of type Nef_polyhedron_3 into a polygon mesh model of MutableFaceGraph.

Note that contrary to Nef_polyhedron_3::convert_to_polyhedron(), the output is not triangulated (but faces with more than one connected component of the boundary). The polygon mesh can be triangulated by setting triangulate_all_faces to true or by calling the function triangulate_faces().

Template Parameters
Nef_polyhedronan object of type Nef_polyhedron_3.
Polygon_mesha model of MutableFaceGraph with an internal property map for CGAL::vertex_point_t.

The points from nef to pm are converted using CGAL::Cartesian_converter<NefKernel, TargetKernel>. NefKernel and TargetKernel are deduced using CGAL::Kernel_traits from the point type of nef and the value type of the vertex_point_map of tm.

Parameters
nefthe input.
pmthe output.
triangulate_all_facesindicates whether all the faces must be triangulated.
Precondition
Polygon_mesh must have an internal point property map with value type being Nef_polyhedron_3::Point_3.
nef.simple()
Examples:
Nef_3/nef_3_to_surface_mesh.cpp.

◆ convert_nef_polyhedron_to_polygon_soup()

template<class Nef_polyhedron , typename PolygonRange , typename PointRange >
void CGAL::convert_nef_polyhedron_to_polygon_soup ( const Nef_polyhedron &  nef,
PointRange &  points,
PolygonRange &  polygons,
bool  triangulate_all_faces = false 
)

#include <CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h>

Converts an objet of type Nef_polyhedron_3 into a polygon soup.

The polygons can be triangulated by setting triangulate_all_faces to true.

Template Parameters
Nef_polyhedronan object of type Nef_polyhedron_3.
PointRangea model of the concept BackInsertionSequence whose value_type is the point type
PolygonRangea model of the concept BackInsertionSequence whose value_type is a model of the concept BackInsertionSequence whose value_type is std::size_t.

The points from nef to points are converted using CGAL::Cartesian_converter<NefKernel, OutputKernel>. NefKernel and OutputKernel are deduced using CGAL::Kernel_traits from the point types.

Parameters
nefthe input.
pointsthe output points of the soup
polygonsthe output polygons of the soup.
triangulate_all_facesindicates whether all polygons must be triangulated.

◆ OFF_to_nef_3()

template<class Nef_polyhedron_3 >
std::size_t CGAL::OFF_to_nef_3 ( std::istream &  in,
Nef_polyhedron_3 N 
)

#include <CGAL/OFF_to_nef_3.h>

This function creates a 3D Nef polyhedron from an OFF file which is read from input stream in.

The purpose of OFF_to_nef_3 is to create a Nef polyhedron from an OFF file that cannot be handled by the Nef_polyhedron_3 constructors. It handles double coordinates while using a homogenous kernel, non-coplanar facets, surfaces with boundaries, self-intersecting surfaces, and single facets. Every closed volume gets marked. The function returns the number of facets it could not handle.

See also
CGAL::Nef_polyhedron_3<Traits>
Examples:
Nef_3/complex_construction.cpp.

◆ operator
template<class Traits >
ostream& CGAL::operator<< ( std::ostream &  out,
CGAL::Nef_polyhedron_3< Traits > &  N 
)

#include <CGAL/IO/Nef_polyhedron_iostream_3.h>

This operator writes the Nef polyhedron N to the output stream out using a proprietary file format.

It includes the complete incidence structure, the geometric data, and the marks of each item.

Using CGAL stream modifiers the following output formats can be chosen: ASCII (set_ascii_mode()), binary (set_binary_mode()) or pretty (set_pretty_mode()). The mandatory format is the ASCII format. It is recommended to use this format for file input and output.

As the output depends on the output operators of the geometric primitives provided by the traits class, it might not be possible that the input operator and output operators of different traits classes are not compatible. We recommend to use the CGAL kernels Homogeneous, Simple_homogeneous, or Extended_homogeneous parametrized with any exact number type that models \(\mathbb{Z}\) (e.g. Gmpz or leda_integer).

A bounded Nef_polyhedron_3<Extended_homogeneous> is automatically written as though Nef_polyhedron_3<Homogeneous> or Nef_polyhedron_3<Simple_homogeneous> is used. As a result, the input operator of each of these types can read the output.

See also
CGAL::Nef_polyhedron_3<Traits>

◆ operator>>()

template<class Traits >
istream& CGAL::operator>> ( std::istream &  in,
CGAL::Nef_polyhedron_3< Traits > &  N 
)

#include <CGAL/IO/Nef_polyhedron_iostream_3.h>

This operator reads a Nef polyhedron, which is given in the proprietary file format written by the input operator in and assigns it to N.

It includes the complete incidence structure, the geometric data, and the marks of each item.

It is recommended to use the CGAL kernels Homogeneous, Simple_homogeneous, or Extended_homogeneous parametrized with any exact number type that models \( \mathbb{Z}\) (e.g.Gmpz or leda_integer). The input and output iterators of Nef polyhedra parametrized with either of these kernels are compatible as long as the Nef polyhedron is bounded. An unbounded Nef polyhedron can only be read by a Nef polyhedron parametrized with an extended kernel. It is also recommended to use the CGAL stream modifier set_ascii_mode().

See also
CGAL::Nef_polyhedron_3<Traits>