SFCGAL 2.3.0
SFCGAL::detail::GeometrySet< Dim > Class Template Reference

A GeometrySet represents a set of CGAL primitives. More...

#include <GeometrySet.h>

Public Types

using PointCollection
 Ordered set of point elements (dimension 0 primitives).
using SegmentCollection
 Ordered set of segment elements (dimension 1 primitives).
using SurfaceCollection
 List of surface elements (dimension 2 primitives).
using VolumeCollection
 List of volume elements (dimension 3 primitives).

Public Member Functions

 GeometrySet ()
 GeometrySet (const Geometry &g)
 Construct a GeometrySet from a SFCGAL::Geometry.
 GeometrySet (const typename TypeForDimension< Dim >::Point &g, int flags=0)
 Construct a GeometrySet from a Point.
 GeometrySet (const typename TypeForDimension< Dim >::Segment &g, int flags=0)
 Construct a GeometrySet from a Segment.
 GeometrySet (const typename TypeForDimension< Dim >::Surface &g, int flags=0)
 Construct a GeometrySet from a Surface.
 GeometrySet (const typename TypeForDimension< Dim >::Volume &g, int flags=0)
 Construct a GeometrySet from a Volume.
auto merge (const GeometrySet< Dim > &g) -> void
 Add primitives from another set.
void addGeometry (const Geometry &g)
 Add a geometry by decomposing it into CGAL primitives.
void addPrimitive (const PrimitiveHandle< Dim > &handle)
 add a primitive from a PrimitiveHandle to the set
void addPrimitive (const CGAL::Object &obj, bool pointsAsRing=false)
 add a primitive from a CGAL::Object to the set pointsAsRing : if set to true, build a polygon if obj is a vector of points
void addPrimitive (const typename TypeForDimension< Dim >::Point &point, int flags=0)
 add a point to the set
template<class IT>
void addPoints (IT ibegin, IT iend)
 Add multiple points from iterator range.
void collectPoints (const PrimitiveHandle< Dim > &b)
 collect all points of b and add them to the point list
void addPrimitive (const typename TypeForDimension< Dim >::Segment &segment, int flags=0)
 add a segment to the set
template<class IT>
void addSegments (IT ibegin, IT iend)
 Add multiple segments from iterator range.
void addPrimitive (const typename TypeForDimension< Dim >::Surface &g, int flags=0)
 add a surface to the set
template<class IT>
void addSurfaces (IT ibegin, IT iend)
 Add multiple surfaces from iterator range.
void addPrimitive (const typename TypeForDimension< Dim >::Volume &g, int flags=0)
 add a volume to the set
template<class IT>
void addVolumes (IT ibegin, IT iend)
 Add multiple volumes from iterator range.
auto dimension () const -> int
 Get the maximum geometry dimension of the set -1 : empty 0 : there are points 1 : there are segments 2 : there are surfaces 3 : there are volumes.
void addBoundary (const typename TypeForDimension< Dim >::Surface &surface)
 Add the boundary (segments) of a surface.
void addBoundary (const typename TypeForDimension< Dim >::Volume &volume)
 Add the boundary (surfaces) of a volume.
void computeBoundingBoxes (typename HandleCollection< Dim >::Type &handles, typename BoxCollection< Dim >::Type &boxes) const
 Compute all bounding boxes and handles of the set.
auto points () -> PointCollection &
 Get mutable reference to point collection.
auto points () const -> const PointCollection &
 Get const reference to point collection.
auto segments () -> SegmentCollection &
 Get mutable reference to segment collection.
auto segments () const -> const SegmentCollection &
 Get const reference to segment collection.
auto surfaces () -> SurfaceCollection &
 Get mutable reference to surface collection.
auto surfaces () const -> const SurfaceCollection &
 Get const reference to surface collection.
auto volumes () -> VolumeCollection &
 Get mutable reference to volume collection.
auto volumes () const -> const VolumeCollection &
 Get const reference to volume collection.
auto hasPoints () const -> bool
 Returns true if the set holds points.
auto hasSegments () const -> bool
 Returns true if the set holds segments.
auto hasSurfaces () const -> bool
 Returns true if the set holds surfaces.
auto hasVolumes () const -> bool
 Returns true if the set holds volumes.
auto recompose () const -> std::unique_ptr< Geometry >
 convert the set to a SFCGAL::Geometry
void filterCovered (GeometrySet< Dim > &output) const
 Filter (remove) primitives that are already covered by others.
void addPrimitive (const PrimitiveHandle< 2 > &primitiveHandle)
 Add primitive to 2D geometry set from primitive handle.
void addPrimitive (const PrimitiveHandle< 3 > &primitiveHandle)
 Add primitive to 3D geometry set from primitive handle.
void addPrimitive (const CGAL::Object &object, bool pointsAsRing)
 Add primitive to 3D geometry set from CGAL object.
void addPrimitive (const CGAL::Object &object, bool pointsAsRing)
 Add primitive to 2D geometry set from CGAL object.
void addPrimitive (const TypeForDimension< 2 >::Surface &surface, int flags)
 Add 2D surface primitive to geometry set.
void addPrimitive (const TypeForDimension< 3 >::Surface &surface, int flags)
 Add 3D surface primitive to geometry set.
void addPrimitive (const TypeForDimension< 2 >::Volume &volume, int flags)
 Add 2D volume primitive to geometry set (no-op for 2D).
void addPrimitive (const TypeForDimension< 3 >::Volume &volume, int flags)
 Add 3D volume primitive to geometry set.
auto hasSurfaces () const -> bool
 Check if 2D geometry set has surfaces.
auto hasSurfaces () const -> bool
 Check if 3D geometry set has surfaces.
auto hasVolumes () const -> bool
 Check if 2D geometry set has volumes.
auto hasVolumes () const -> bool
 Check if 3D geometry set has volumes.
void addBoundary (const TypeForDimension< 2 >::Surface &surface)
 Add boundary segments from 2D surface.
void addBoundary (const TypeForDimension< 3 >::Surface &surface)
 Add boundary from 3D surface (not implemented).
auto dimension () const -> int
 Get maximum geometry dimension for 2D set.
auto dimension () const -> int
 Get maximum geometry dimension for 3D set.

Detailed Description

template<int Dim>
class SFCGAL::detail::GeometrySet< Dim >

A GeometrySet represents a set of CGAL primitives.

Primitive are either of dimension 0 (points), dimension 1 (segments), dimension 2 (surfaces, a.k.a. polygon or triangles) or dimension 3 (polyhedron)

Member Typedef Documentation

◆ PointCollection

template<int Dim>
using SFCGAL::detail::GeometrySet< Dim >::PointCollection
Initial value:
std::set<CollectionElement<typename Point_d<Dim>::Type>>

Ordered set of point elements (dimension 0 primitives).

◆ SegmentCollection

template<int Dim>
using SFCGAL::detail::GeometrySet< Dim >::SegmentCollection
Initial value:
std::set<CollectionElement<typename Segment_d<Dim>::Type>>

Ordered set of segment elements (dimension 1 primitives).

◆ SurfaceCollection

template<int Dim>
using SFCGAL::detail::GeometrySet< Dim >::SurfaceCollection
Initial value:
std::list<CollectionElement<typename Surface_d<Dim>::Type>>

List of surface elements (dimension 2 primitives).

◆ VolumeCollection

template<int Dim>
using SFCGAL::detail::GeometrySet< Dim >::VolumeCollection
Initial value:
std::list<CollectionElement<typename Volume_d<Dim>::Type>>

List of volume elements (dimension 3 primitives).

Constructor & Destructor Documentation

◆ GeometrySet() [1/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( )
default

◆ GeometrySet() [2/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( const Geometry & g)

Construct a GeometrySet from a SFCGAL::Geometry.

Parameters
gThe geometry to convert to GeometrySet

◆ GeometrySet() [3/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( const typename TypeForDimension< Dim >::Point & g,
int flags = 0 )

Construct a GeometrySet from a Point.

Parameters
gThe point to add to the set
flagsOptional flags for the point

◆ GeometrySet() [4/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( const typename TypeForDimension< Dim >::Segment & g,
int flags = 0 )

Construct a GeometrySet from a Segment.

Parameters
gThe segment to add to the set
flagsOptional flags for the segment

◆ GeometrySet() [5/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( const typename TypeForDimension< Dim >::Surface & g,
int flags = 0 )

Construct a GeometrySet from a Surface.

Parameters
gThe surface to add to the set
flagsOptional flags for the surface

◆ GeometrySet() [6/6]

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( const typename TypeForDimension< Dim >::Volume & g,
int flags = 0 )

Construct a GeometrySet from a Volume.

Parameters
gThe volume to add to the set
flagsOptional flags for the volume

Member Function Documentation

◆ addBoundary() [1/4]

void SFCGAL::detail::GeometrySet< 2 >::addBoundary ( const TypeForDimension< 2 >::Surface & surface)

Add boundary segments from 2D surface.

Parameters
surfaceThe surface whose boundary to add

◆ addBoundary() [2/4]

void SFCGAL::detail::GeometrySet< 3 >::addBoundary ( const TypeForDimension< 3 >::Surface & surface)

Add boundary from 3D surface (not implemented).

Parameters
surfaceThe surface (unused)

◆ addBoundary() [3/4]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addBoundary ( const typename TypeForDimension< Dim >::Surface & surface)

Add the boundary (segments) of a surface.

Parameters
surfaceThe surface whose boundary to add

◆ addBoundary() [4/4]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addBoundary ( const typename TypeForDimension< Dim >::Volume & volume)

Add the boundary (surfaces) of a volume.

Parameters
volumeThe volume whose boundary to add

◆ addGeometry()

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addGeometry ( const Geometry & g)

Add a geometry by decomposing it into CGAL primitives.

Parameters
gThe geometry to decompose and add

◆ addPoints()

template<int Dim>
template<class IT>
void SFCGAL::detail::GeometrySet< Dim >::addPoints ( IT ibegin,
IT iend )
inline

Add multiple points from iterator range.

Parameters
ibeginIterator to first point
iendIterator to end of points

◆ addPrimitive() [1/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const CGAL::Object & obj,
bool pointsAsRing = false )

add a primitive from a CGAL::Object to the set pointsAsRing : if set to true, build a polygon if obj is a vector of points

Parameters
objThe CGAL object to add as primitive
pointsAsRingIf true, build polygon from point vector

◆ addPrimitive() [2/14]

void SFCGAL::detail::GeometrySet< 2 >::addPrimitive ( const CGAL::Object & object,
bool pointsAsRing )

Add primitive to 2D geometry set from CGAL object.

Parameters
objectThe CGAL object to add as primitive
pointsAsRingIf true, build polygon from point vector

◆ addPrimitive() [3/14]

void SFCGAL::detail::GeometrySet< 3 >::addPrimitive ( const CGAL::Object & object,
bool pointsAsRing )

Add primitive to 3D geometry set from CGAL object.

Parameters
objectThe CGAL object to add as primitive
pointsAsRingIf true, build polygon from point vector

◆ addPrimitive() [4/14]

void SFCGAL::detail::GeometrySet< 2 >::addPrimitive ( const PrimitiveHandle< 2 > & primitiveHandle)

Add primitive to 2D geometry set from primitive handle.

Parameters
primitiveHandleThe primitive handle to add

◆ addPrimitive() [5/14]

void SFCGAL::detail::GeometrySet< 3 >::addPrimitive ( const PrimitiveHandle< 3 > & primitiveHandle)

Add primitive to 3D geometry set from primitive handle.

Parameters
primitiveHandleThe primitive handle to add

◆ addPrimitive() [6/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const PrimitiveHandle< Dim > & handle)

add a primitive from a PrimitiveHandle to the set

Parameters
handleThe primitive handle to add

◆ addPrimitive() [7/14]

void SFCGAL::detail::GeometrySet< 2 >::addPrimitive ( const TypeForDimension< 2 >::Surface & surface,
int flags )

Add 2D surface primitive to geometry set.

Parameters
surfaceThe surface to add
flagsOptional flags for the surface

◆ addPrimitive() [8/14]

void SFCGAL::detail::GeometrySet< 2 >::addPrimitive ( const TypeForDimension< 2 >::Volume & volume,
int flags )

Add 2D volume primitive to geometry set (no-op for 2D).

Parameters
volumeThe volume (unused in 2D)
flagsThe flags (unused)

◆ addPrimitive() [9/14]

void SFCGAL::detail::GeometrySet< 3 >::addPrimitive ( const TypeForDimension< 3 >::Surface & surface,
int flags )

Add 3D surface primitive to geometry set.

Parameters
surfaceThe surface to add
flagsOptional flags for the surface

◆ addPrimitive() [10/14]

void SFCGAL::detail::GeometrySet< 3 >::addPrimitive ( const TypeForDimension< 3 >::Volume & volume,
int flags )

Add 3D volume primitive to geometry set.

Parameters
volumeThe volume to add
flagsOptional flags for the volume

◆ addPrimitive() [11/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const typename TypeForDimension< Dim >::Point & point,
int flags = 0 )

add a point to the set

Parameters
pointThe point to add
flagsOptional flags for the point

◆ addPrimitive() [12/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const typename TypeForDimension< Dim >::Segment & segment,
int flags = 0 )

add a segment to the set

Parameters
segmentThe segment to add
flagsOptional flags for the segment

◆ addPrimitive() [13/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const typename TypeForDimension< Dim >::Surface & g,
int flags = 0 )

add a surface to the set

Parameters
gThe surface to add
flagsOptional flags for the surface

◆ addPrimitive() [14/14]

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::addPrimitive ( const typename TypeForDimension< Dim >::Volume & g,
int flags = 0 )

add a volume to the set

Parameters
gThe volume to add
flagsOptional flags for the volume

◆ addSegments()

template<int Dim>
template<class IT>
void SFCGAL::detail::GeometrySet< Dim >::addSegments ( IT ibegin,
IT iend )
inline

Add multiple segments from iterator range.

Parameters
ibeginIterator to first segment
iendIterator to end of segments

◆ addSurfaces()

template<int Dim>
template<class IT>
void SFCGAL::detail::GeometrySet< Dim >::addSurfaces ( IT ibegin,
IT iend )
inline

Add multiple surfaces from iterator range.

Parameters
ibeginIterator to first surface
iendIterator to end of surfaces

◆ addVolumes()

template<int Dim>
template<class IT>
void SFCGAL::detail::GeometrySet< Dim >::addVolumes ( IT ibegin,
IT iend )
inline

Add multiple volumes from iterator range.

Parameters
ibeginIterator to first volume
iendIterator to end of volumes

◆ collectPoints()

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::collectPoints ( const PrimitiveHandle< Dim > & b)

collect all points of b and add them to the point list

Parameters
bThe primitive handle to extract points from

◆ computeBoundingBoxes()

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::computeBoundingBoxes ( typename HandleCollection< Dim >::Type & handles,
typename BoxCollection< Dim >::Type & boxes ) const

Compute all bounding boxes and handles of the set.

Parameters
handlesOutput collection to store primitive handles
boxesOutput collection to store bounding boxes

◆ dimension() [1/3]

auto SFCGAL::detail::GeometrySet< 3 >::dimension ( ) const -> int

Get maximum geometry dimension for 3D set.

Returns
Maximum dimension (3 for closed volumes, 2 for surfaces, 1 for segments, 0 for points, -1 if empty)

◆ dimension() [2/3]

auto SFCGAL::detail::GeometrySet< 2 >::dimension ( ) const -> int

Get maximum geometry dimension for 2D set.

Returns
Maximum dimension (2 for surfaces, 1 for segments, 0 for points, -1 if empty)

◆ dimension() [3/3]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::dimension ( ) const -> int
nodiscard

Get the maximum geometry dimension of the set -1 : empty 0 : there are points 1 : there are segments 2 : there are surfaces 3 : there are volumes.

Returns
The maximum dimension of geometries in the set

◆ filterCovered()

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::filterCovered ( GeometrySet< Dim > & output) const

Filter (remove) primitives that are already covered by others.

Parameters
outputThe output geometry set with filtered primitives

◆ hasPoints()

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasPoints ( ) const -> bool
nodiscard

Returns true if the set holds points.

Returns
True if the set contains points

◆ hasSegments()

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasSegments ( ) const -> bool
nodiscard

Returns true if the set holds segments.

Returns
True if the set contains segments

◆ hasSurfaces() [1/3]

auto SFCGAL::detail::GeometrySet< 3 >::hasSurfaces ( ) const -> bool

Check if 3D geometry set has surfaces.

Returns
True if the set contains surfaces or volumes

◆ hasSurfaces() [2/3]

auto SFCGAL::detail::GeometrySet< 2 >::hasSurfaces ( ) const -> bool

Check if 2D geometry set has surfaces.

Returns
True if the set contains surfaces

◆ hasSurfaces() [3/3]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasSurfaces ( ) const -> bool
nodiscard

Returns true if the set holds surfaces.

Returns
True if the set contains surfaces

◆ hasVolumes() [1/3]

auto SFCGAL::detail::GeometrySet< 3 >::hasVolumes ( ) const -> bool

Check if 3D geometry set has volumes.

Returns
True if the set contains volumes

◆ hasVolumes() [2/3]

auto SFCGAL::detail::GeometrySet< 2 >::hasVolumes ( ) const -> bool

Check if 2D geometry set has volumes.

Returns
Always false for 2D sets

◆ hasVolumes() [3/3]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasVolumes ( ) const -> bool
nodiscard

Returns true if the set holds volumes.

Returns
True if the set contains volumes

◆ merge()

template<int Dim>
void SFCGAL::detail::GeometrySet< Dim >::merge ( const GeometrySet< Dim > & g) -> void

Add primitives from another set.

Parameters
gThe geometry set to merge from

◆ points() [1/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::points ( ) -> PointCollection &
inlinenodiscard

Get mutable reference to point collection.

Returns
Reference to the point collection

◆ points() [2/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::points ( ) const -> const PointCollection &
inlinenodiscard

Get const reference to point collection.

Returns
Const reference to the point collection

◆ recompose()

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::recompose ( ) const -> std::unique_ptr< Geometry >
nodiscard

convert the set to a SFCGAL::Geometry

Returns
Unique pointer to the recomposed geometry

◆ segments() [1/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::segments ( ) -> SegmentCollection &
inlinenodiscard

Get mutable reference to segment collection.

Returns
Reference to the segment collection

◆ segments() [2/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::segments ( ) const -> const SegmentCollection &
inlinenodiscard

Get const reference to segment collection.

Returns
Const reference to the segment collection

◆ surfaces() [1/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::surfaces ( ) -> SurfaceCollection &
inlinenodiscard

Get mutable reference to surface collection.

Returns
Reference to the surface collection

◆ surfaces() [2/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::surfaces ( ) const -> const SurfaceCollection &
inlinenodiscard

Get const reference to surface collection.

Returns
Const reference to the surface collection

◆ volumes() [1/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::volumes ( ) -> VolumeCollection &
inlinenodiscard

Get mutable reference to volume collection.

Returns
Reference to the volume collection

◆ volumes() [2/2]

template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::volumes ( ) const -> const VolumeCollection &
inlinenodiscard

Get const reference to volume collection.

Returns
Const reference to the volume collection