SFCGAL 2.3.0
SFCGAL::PolyhedralSurface Class Reference

A PolyhedralSurface in SFA modeled as a Polygon soup. More...

#include <PolyhedralSurface.h>

Public Types

using iterator
 Iterator type for polyhedral surface patches.
using const_iterator
 Const iterator type for polyhedral surface patches.
using value_type = Polygon
 Value type for container compatibility.
using reference = Polygon &
 Reference type for container compatibility.
using const_reference = const Polygon &
 Const reference type for container compatibility.

Public Member Functions

 PolyhedralSurface ()
 Empty PolyhedralSurface constructor.
 PolyhedralSurface (const std::vector< Polygon > &polygons)
 Constructor with a vector of polygons.
 PolyhedralSurface (const std::unique_ptr< Geometry > &geometry)
 Constructor with a Geometry.
template<typename Polyhedron>
 PolyhedralSurface (const Polyhedron &poly)
 Constructor from a Polyhedron (detail::MarkedPolyhedron or CGAL::Polyhedron_3).
 PolyhedralSurface (const Mesh &sm, bool simplifyTriangulation=true)
 Constructor from a CGAL::Surface_mesh.
 PolyhedralSurface (const InexactMesh &inexactMesh)
 Constructor from an inexact CGAL::Surface_mesh.
 PolyhedralSurface (const PolyhedralSurface &other)
 Copy constructor.
auto operator= (PolyhedralSurface other) -> PolyhedralSurface &
 assign operator
 ~PolyhedralSurface () override
 destructor
auto geometryType () const -> std::string override
 Get the geometry type as string.
auto geometryTypeId () const -> GeometryType override
 Get the geometry type identifier.
auto dimension () const -> int override
 Get the dimension of the polyhedral surface.
auto coordinateDimension () const -> int override
 Get the coordinate dimension.
auto isEmpty () const -> bool override
 Check if the polyhedral surface is empty.
auto is3D () const -> bool override
 Check if the polyhedral surface has 3D coordinates.
auto isMeasured () const -> bool override
 Check if the polyhedral surface has measured coordinates.
auto dropZ () -> bool override
 Drop Z coordinate from all polygons.
auto dropM () -> bool override
 Drop M coordinate from all polygons.
auto swapXY () -> void override
 Swap X and Y coordinates of all polygons.
auto toTriangulatedSurface () const -> TriangulatedSurface
 Convert PolyhedralSurface to TriangulatedSurface.
auto numPatches () const -> size_t
 [SFA/OGC]Returns the number of patches
auto numPolygons () const -> size_t
 [SFA/OGC]Returns the number of polygons
auto patchN (size_t const &index) const -> const Polygon &
 [SFA/OGC]Returns the n-th patch
auto patchN (size_t const &index) -> Polygon &
 [SFA/OGC]Returns the n-th patch
void addPatch (const Polygon &patch)
 Adds a polygonal patch to the PolyhedralSurface.
void addPatch (Polygon *patch)
 Adds a polygonal patch to the PolyhedralSurface.
void addPatch (std::unique_ptr< Polygon > patch)
 Adds a polygonal patch to the PolyhedralSurface.
void addPatches (const PolyhedralSurface &polyhedralSurface)
 add patches from an other PolyhedralSurface
auto polygonN (size_t const &index) const -> const Polygon &
 [SFA/OGC]Returns the n-th polygon
auto polygonN (size_t const &index) -> Polygon &
 [SFA/OGC]Returns the n-th polygon
void addPolygon (const Polygon &polygon)
 add a polygon to the PolyhedralSurface
void addPolygon (Polygon *polygon)
 add a polygon to the PolyhedralSurface
void addPolygons (const PolyhedralSurface &polyhedralSurface)
 add polygons from an other PolyhedralSurface
void setPatchN (const Geometry &geometry, size_t const &idx)
 Sets the n-th Geometry, starting at zero.
void setPatchN (Geometry *geometry, size_t const &idx)
 Sets the n-th Geometry, starting at zero.
void setPatchN (std::unique_ptr< Geometry > geometry, size_t const &idx)
 Sets the n-th patch in the PolyhedralSurface.
void setPatchN (const Polygon &patch, size_t const &idx)
 Sets the n-th Patch, starting at zero.
void setPatchN (Polygon *patch, size_t const &idx)
 Sets the n-th Patch, starting at zero.
void setPatchN (std::unique_ptr< Polygon > patch, size_t const &idx)
 Sets the n-th patch in the PolyhedralSurface.
template<typename Polyhedron>
auto toPolyhedron_3 () const -> std::unique_ptr< Polyhedron >
 Convert to CGAL::Polyhedron_3.
auto begin () -> iterator
 Get iterator to beginning of patches.
auto begin () const -> const_iterator
 Get const iterator to beginning of patches.
auto end () -> iterator
 Get iterator to end of patches.
auto end () const -> const_iterator
 Get const iterator to end of patches.
void accept (GeometryVisitor &visitor) override
 Accept a geometry visitor.
void accept (ConstGeometryVisitor &visitor) const override
 Accept a const geometry visitor.
auto toSurfaceMesh () const -> Surface_mesh_3
 Convert PolyhedralSurface to CGAL::Surface_mesh.
auto numEdges () const -> size_t
 Returns the number of edges in the geometry.
template<class Archive>
void serialize (Archive &ar, const unsigned int)
 Serializer.
void push_back (const Polygon &polygon)
 Add a polygon patch (container compatibility).

Detailed Description

A PolyhedralSurface in SFA modeled as a Polygon soup.

Todo
do better than a "polygon soup" or add topological view?

Member Typedef Documentation

◆ const_iterator

Initial value:
std::vector<std::unique_ptr<Polygon>>::const_iterator>
Iterator adapter that dereferences unique_ptr elements automatically.
Definition DereferenceIterator.h:22
DereferenceIterator< std::vector< std::unique_ptr< Geometry > >::const_iterator > const_iterator
Const iterator type for geometry collection.
Definition GeometryCollection.h:30

Const iterator type for polyhedral surface patches.

◆ const_reference

Const reference type for container compatibility.

◆ iterator

Initial value:
DereferenceIterator< std::vector< std::unique_ptr< Geometry > >::iterator > iterator
Iterator type for geometry collection.
Definition GeometryCollection.h:27

Iterator type for polyhedral surface patches.

◆ reference

Reference type for container compatibility.

◆ value_type

Value type for container compatibility.

Constructor & Destructor Documentation

◆ PolyhedralSurface() [1/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( )
default

Empty PolyhedralSurface constructor.

◆ PolyhedralSurface() [2/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( const std::vector< Polygon > & polygons)

Constructor with a vector of polygons.

Parameters
polygonsVector of polygons to initialize the surface

◆ PolyhedralSurface() [3/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( const std::unique_ptr< Geometry > & geometry)

Constructor with a Geometry.

Parameters
geometryThe geometry to convert to polyhedral surface

◆ PolyhedralSurface() [4/7]

template<typename Polyhedron>
SFCGAL::PolyhedralSurface::PolyhedralSurface ( const Polyhedron & poly)
inline

Constructor from a Polyhedron (detail::MarkedPolyhedron or CGAL::Polyhedron_3).

Template Parameters
PolyhedronThe CGAL polyhedron type
Parameters
polyThe polyhedron to convert

◆ PolyhedralSurface() [5/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( const Mesh & sm,
bool simplifyTriangulation = true )

Constructor from a CGAL::Surface_mesh.

Parameters
smThe surface mesh to convert
simplifyTriangulationIf set to true, the conversion reconstructs patches by merging adjacent triangles (i.e. removes the triangulation). Boundaries, including holes, are kept.

If set to false, the output surface is fully triangulated.

◆ PolyhedralSurface() [6/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( const InexactMesh & inexactMesh)

Constructor from an inexact CGAL::Surface_mesh.

Parameters
inexactMeshThe inexact surface mesh to convert

◆ PolyhedralSurface() [7/7]

SFCGAL::PolyhedralSurface::PolyhedralSurface ( const PolyhedralSurface & other)

Copy constructor.

Parameters
otherThe polyhedral surface to copy from

◆ ~PolyhedralSurface()

SFCGAL::PolyhedralSurface::~PolyhedralSurface ( )
overridedefault

destructor

Member Function Documentation

◆ accept() [1/2]

void SFCGAL::PolyhedralSurface::accept ( ConstGeometryVisitor & visitor) const
override

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept

◆ accept() [2/2]

void SFCGAL::PolyhedralSurface::accept ( GeometryVisitor & visitor)
override

Accept a geometry visitor.

Parameters
visitorVisitor to accept

◆ addPatch() [1/3]

void SFCGAL::PolyhedralSurface::addPatch ( const Polygon & patch)

Adds a polygonal patch to the PolyhedralSurface.

Parameters
patchThe Polygon object representing the new patch to add.

◆ addPatch() [2/3]

void SFCGAL::PolyhedralSurface::addPatch ( Polygon * patch)

Adds a polygonal patch to the PolyhedralSurface.

Parameters
patchA raw pointer to the Polygon object representing the new patch to add. Ownership of this patch is moved into the PolyhedralSurface.
Deprecated
The unique_ptr version should be used instead

◆ addPatch() [3/3]

void SFCGAL::PolyhedralSurface::addPatch ( std::unique_ptr< Polygon > patch)

Adds a polygonal patch to the PolyhedralSurface.

Parameters
patchA unique pointer to the Polygon object representing the new patch to add. Ownership of this patch is moved into the PolyhedralSurface.

◆ addPatches()

void SFCGAL::PolyhedralSurface::addPatches ( const PolyhedralSurface & polyhedralSurface)

add patches from an other PolyhedralSurface

Parameters
polyhedralSurfaceThe polyhedral surface to add patches from

◆ addPolygon() [1/2]

void SFCGAL::PolyhedralSurface::addPolygon ( const Polygon & polygon)

add a polygon to the PolyhedralSurface

Parameters
polygonThe polygon to add
Deprecated
see addPatch()

◆ addPolygon() [2/2]

void SFCGAL::PolyhedralSurface::addPolygon ( Polygon * polygon)

add a polygon to the PolyhedralSurface

Parameters
polygonThe polygon to add
Deprecated
see addPatch()

◆ addPolygons()

void SFCGAL::PolyhedralSurface::addPolygons ( const PolyhedralSurface & polyhedralSurface)

add polygons from an other PolyhedralSurface

Parameters
polyhedralSurfaceThe polyhedral surface to add polygons from
Deprecated
see addPatches()

◆ begin() [1/2]

auto SFCGAL::PolyhedralSurface::begin ( ) -> iterator
inline

Get iterator to beginning of patches.

Returns
Iterator to first patch

◆ begin() [2/2]

auto SFCGAL::PolyhedralSurface::begin ( ) const -> const_iterator
inlinenodiscard

Get const iterator to beginning of patches.

Returns
Const iterator to first patch

◆ coordinateDimension()

auto SFCGAL::PolyhedralSurface::coordinateDimension ( ) const -> int
nodiscardoverride

Get the coordinate dimension.

Returns
Number of coordinates per point

◆ dimension()

auto SFCGAL::PolyhedralSurface::dimension ( ) const -> int
nodiscardoverride

Get the dimension of the polyhedral surface.

Returns
2 (surfaces are 2-dimensional)

◆ dropM()

auto SFCGAL::PolyhedralSurface::dropM ( ) -> bool
override

Drop M coordinate from all polygons.

Returns
true if M was dropped, false otherwise

◆ dropZ()

auto SFCGAL::PolyhedralSurface::dropZ ( ) -> bool
override

Drop Z coordinate from all polygons.

Returns
true if Z was dropped, false otherwise

◆ end() [1/2]

auto SFCGAL::PolyhedralSurface::end ( ) -> iterator
inline

Get iterator to end of patches.

Returns
Iterator to past-the-end

◆ end() [2/2]

auto SFCGAL::PolyhedralSurface::end ( ) const -> const_iterator
inlinenodiscard

Get const iterator to end of patches.

Returns
Const iterator to past-the-end

◆ geometryType()

auto SFCGAL::PolyhedralSurface::geometryType ( ) const -> std::string
nodiscardoverride

Get the geometry type as string.

Returns
"PolyhedralSurface"

◆ geometryTypeId()

auto SFCGAL::PolyhedralSurface::geometryTypeId ( ) const -> GeometryType
nodiscardoverride

Get the geometry type identifier.

Returns
TYPE_POLYHEDRALSURFACE

◆ is3D()

auto SFCGAL::PolyhedralSurface::is3D ( ) const -> bool
nodiscardoverride

Check if the polyhedral surface has 3D coordinates.

Returns
true if 3D, false otherwise

◆ isEmpty()

auto SFCGAL::PolyhedralSurface::isEmpty ( ) const -> bool
nodiscardoverride

Check if the polyhedral surface is empty.

Returns
true if empty, false otherwise

◆ isMeasured()

auto SFCGAL::PolyhedralSurface::isMeasured ( ) const -> bool
nodiscardoverride

Check if the polyhedral surface has measured coordinates.

Returns
true if measured, false otherwise

◆ numEdges()

auto SFCGAL::PolyhedralSurface::numEdges ( ) const -> size_t
nodiscard

Returns the number of edges in the geometry.

Convert the geometry to a CGAL::Surface_mesh and use the mesh number_of_edges accessor. As the conversion to a Surface mesh may be costly, it is advised not to call this method into a for-loop.

Returns
Number of edges in the geometry

◆ numPatches()

auto SFCGAL::PolyhedralSurface::numPatches ( ) const -> size_t
inlinenodiscard

[SFA/OGC]Returns the number of patches

Returns
Number of polygonal patches in the surface
Warning
PolyhedralSurface is treated as one geometry. numGeometries returns 1 or 0 for empty PolyhedralSurface

◆ numPolygons()

auto SFCGAL::PolyhedralSurface::numPolygons ( ) const -> size_t
inlinenodiscard

[SFA/OGC]Returns the number of polygons

Returns
Number of polygons in the surface
Warning
PolyhedralSurface is treated as one geometry. numGeometries returns 1 or 0 for empty PolyhedralSurface
Deprecated
see numPatches
See also
numGeometries()

◆ operator=()

auto SFCGAL::PolyhedralSurface::operator= ( PolyhedralSurface other) -> PolyhedralSurface &

assign operator

Parameters
otherThe polyhedral surface to assign from
Returns
Reference to this polyhedral surface

◆ patchN() [1/2]

auto SFCGAL::PolyhedralSurface::patchN ( size_t const & index) -> Polygon &
inline

[SFA/OGC]Returns the n-th patch

Parameters
indexThe index of the patch to get
Returns
Reference to the nth patch

◆ patchN() [2/2]

auto SFCGAL::PolyhedralSurface::patchN ( size_t const & index) const -> const Polygon &
inlinenodiscard

[SFA/OGC]Returns the n-th patch

Parameters
indexThe index of the patch to get
Returns
Const reference to the nth patch

◆ polygonN() [1/2]

auto SFCGAL::PolyhedralSurface::polygonN ( size_t const & index) -> Polygon &
inline

[SFA/OGC]Returns the n-th polygon

Parameters
indexIndex of the polygon to get
Returns
Reference to the nth polygon
Deprecated
see patchN()

◆ polygonN() [2/2]

auto SFCGAL::PolyhedralSurface::polygonN ( size_t const & index) const -> const Polygon &
inlinenodiscard

[SFA/OGC]Returns the n-th polygon

Parameters
indexIndex of the polygon to get
Returns
Const reference to the nth polygon
Deprecated
see patchN()

◆ push_back()

void SFCGAL::PolyhedralSurface::push_back ( const Polygon & polygon)
inline

Add a polygon patch (container compatibility).

Parameters
polygonThe polygon to add as a patch

◆ serialize()

template<class Archive>
void SFCGAL::PolyhedralSurface::serialize ( Archive & ar,
const unsigned int  )
inline

Serializer.

Parameters
arArchive for serialization

◆ setPatchN() [1/6]

void SFCGAL::PolyhedralSurface::setPatchN ( const Geometry & geometry,
size_t const & idx )

Sets the n-th Geometry, starting at zero.

Parameters
geometryGeometry to set (must be a polygon)
idxIndex of the patch to set

◆ setPatchN() [2/6]

void SFCGAL::PolyhedralSurface::setPatchN ( const Polygon & patch,
size_t const & idx )

Sets the n-th Patch, starting at zero.

Parameters
patchPolygon patch to set
idxIndex of the patch to set

◆ setPatchN() [3/6]

void SFCGAL::PolyhedralSurface::setPatchN ( Geometry * geometry,
size_t const & idx )

Sets the n-th Geometry, starting at zero.

Parameters
geometryPointer to geometry (must be a polygon)
idxIndex of the patch to set
Note
The ownership of the polygon is taken. The caller is not responsible anymore of its deallocation.
Deprecated
The unique_ptr version should be used instead

◆ setPatchN() [4/6]

void SFCGAL::PolyhedralSurface::setPatchN ( Polygon * patch,
size_t const & idx )

Sets the n-th Patch, starting at zero.

Parameters
patchPointer to polygon patch
idxIndex of the patch to set
Note
The ownership of the polygon is taken. The caller is not responsible anymore of its deallocation.
Deprecated
The unique_ptr version should be used instead

◆ setPatchN() [5/6]

void SFCGAL::PolyhedralSurface::setPatchN ( std::unique_ptr< Geometry > geometry,
size_t const & idx )

Sets the n-th patch in the PolyhedralSurface.

Replaces the patch at the specified index with the provided one. Only polygon geometries are allowed. Indexing starts at zero.

Parameters
geometryA unique pointer to the Geometry object to set. Ownership is transferred to this class.
idxThe zero-based index of the patch to replace.

◆ setPatchN() [6/6]

void SFCGAL::PolyhedralSurface::setPatchN ( std::unique_ptr< Polygon > patch,
size_t const & idx )

Sets the n-th patch in the PolyhedralSurface.

Replaces the patch at the specified index with the provided one. Indexing starts at zero.

Parameters
patchA unique pointer to the Polygon object to set. Ownership is transferred to this class.
idxThe zero-based index of the patch to replace.

◆ swapXY()

auto SFCGAL::PolyhedralSurface::swapXY ( ) -> void
override

Swap X and Y coordinates of all polygons.

◆ toPolyhedron_3()

template<typename Polyhedron>
auto SFCGAL::PolyhedralSurface::toPolyhedron_3 ( ) const -> std::unique_ptr< Polyhedron >
inline

Convert to CGAL::Polyhedron_3.

Returns
Unique pointer to CGAL polyhedron representation

◆ toSurfaceMesh()

auto SFCGAL::PolyhedralSurface::toSurfaceMesh ( ) const -> Surface_mesh_3
nodiscard

Convert PolyhedralSurface to CGAL::Surface_mesh.

Returns
CGAL Surface_mesh representation of the polyhedral surface

◆ toTriangulatedSurface()

auto SFCGAL::PolyhedralSurface::toTriangulatedSurface ( ) const -> TriangulatedSurface
nodiscard

Convert PolyhedralSurface to TriangulatedSurface.

Returns
A triangulated surface representation