SFCGAL  2.3.0
Public Types | Public Member Functions | List of all members
SFCGAL::detail::GeometrySet< Dim > Class Template Reference

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

#include <GeometrySet.h>

Public Types

using PointCollection = std::set< CollectionElement< typename Point_d< Dim >::Type >>
 Ordered set of point elements (dimension 0 primitives) More...
 
using SegmentCollection = std::set< CollectionElement< typename Segment_d< Dim >::Type >>
 Ordered set of segment elements (dimension 1 primitives) More...
 
using SurfaceCollection = std::list< CollectionElement< typename Surface_d< Dim >::Type >>
 List of surface elements (dimension 2 primitives) More...
 
using VolumeCollection = std::list< CollectionElement< typename Volume_d< Dim >::Type >>
 List of volume elements (dimension 3 primitives) More...
 

Public Member Functions

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

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

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

Ordered set of point elements (dimension 0 primitives)

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

Ordered set of segment elements (dimension 1 primitives)

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

List of surface elements (dimension 2 primitives)

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

List of volume elements (dimension 3 primitives)

Constructor & Destructor Documentation

template<int Dim>
SFCGAL::detail::GeometrySet< Dim >::GeometrySet ( )
default
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
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
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
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
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

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
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
template<>
void SFCGAL::detail::GeometrySet< 2 >::addBoundary ( const TypeForDimension< 2 >::Surface &  surface)

Add boundary segments from 2D surface.

Parameters
surfaceThe surface whose boundary to add
template<>
void SFCGAL::detail::GeometrySet< 3 >::addBoundary ( [[maybe_unused] ] const TypeForDimension< 3 >::Surface &  surface)

Add boundary from 3D surface (not implemented)

Parameters
surfaceThe surface (unused)
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
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
template<>
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
template<>
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
template<>
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
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
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
template<>
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
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
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
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
template<>
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
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
template<>
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
template<>
void SFCGAL::detail::GeometrySet< 2 >::addPrimitive ( [[maybe_unused] ] const TypeForDimension< 2 >::Volume &  volume,
[[maybe_unused] ] int  flags 
)

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

Parameters
volumeThe volume (unused in 2D)
flagsThe flags (unused)
template<>
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
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
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
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
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
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
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::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.

Returns
The maximum dimension of geometries in the set
template<>
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)
template<>
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)
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
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasPoints ( ) const -> bool

Returns true if the set holds points.

Returns
True if the set contains points
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasSegments ( ) const -> bool

Returns true if the set holds segments.

Returns
True if the set contains segments
template<>
auto SFCGAL::detail::GeometrySet< 2 >::hasSurfaces ( ) const -> bool

Check if 2D geometry set has surfaces.

Returns
True if the set contains surfaces
template<>
auto SFCGAL::detail::GeometrySet< 3 >::hasSurfaces ( ) const -> bool

Check if 3D geometry set has surfaces.

Returns
True if the set contains surfaces or volumes
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasSurfaces ( ) const -> bool

Returns true if the set holds surfaces.

Returns
True if the set contains surfaces
template<>
auto SFCGAL::detail::GeometrySet< 2 >::hasVolumes ( ) const -> bool

Check if 2D geometry set has volumes.

Returns
Always false for 2D sets
template<>
auto SFCGAL::detail::GeometrySet< 3 >::hasVolumes ( ) const -> bool

Check if 3D geometry set has volumes.

Returns
True if the set contains volumes
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::hasVolumes ( ) const -> bool

Returns true if the set holds volumes.

Returns
True if the set contains volumes
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
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::points ( ) -> PointCollection &
inline

Get mutable reference to point collection.

Returns
Reference to the point collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::points ( ) const -> const PointCollection &
inline

Get const reference to point collection.

Returns
Const reference to the point collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::recompose ( ) const -> std::unique_ptr<Geometry>

convert the set to a SFCGAL::Geometry

Returns
Unique pointer to the recomposed geometry
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::segments ( ) -> SegmentCollection &
inline

Get mutable reference to segment collection.

Returns
Reference to the segment collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::segments ( ) const -> const SegmentCollection &
inline

Get const reference to segment collection.

Returns
Const reference to the segment collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::surfaces ( ) -> SurfaceCollection &
inline

Get mutable reference to surface collection.

Returns
Reference to the surface collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::surfaces ( ) const -> const SurfaceCollection &
inline

Get const reference to surface collection.

Returns
Const reference to the surface collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::volumes ( ) -> VolumeCollection &
inline

Get mutable reference to volume collection.

Returns
Reference to the volume collection
template<int Dim>
auto SFCGAL::detail::GeometrySet< Dim >::volumes ( ) const -> const VolumeCollection &
inline

Get const reference to volume collection.

Returns
Const reference to the volume collection