SFCGAL
Classes | Enumerations | Functions
Public C++ API

Classes

struct  SFCGAL::algorithm::NoValidityCheck
 Tag used for variants of algorithm that do not do validity check. More...
 
class  SFCGAL::Geometry
 OGC/SFA based Geometry abstract class. More...
 
class  SFCGAL::GeometryCollection
 A GeometryCollection in SFA. More...
 
class  SFCGAL::LineString
 A LineString in SFA. More...
 
class  SFCGAL::MultiLineString
 A MultiLineString in SFA. More...
 
class  SFCGAL::MultiPoint
 A MultiPoint in SFA. More...
 
class  SFCGAL::MultiPolygon
 A MultiPolygon in SFA. More...
 
class  SFCGAL::MultiSolid
 A MultiSolid. More...
 
class  SFCGAL::Point
 A point in SFA. More...
 
class  SFCGAL::Polygon
 A Polygon in SFA with holes. More...
 
class  SFCGAL::PolyhedralSurface
 A PolyhedralSurface in SFA modeled as a Polygon soup. More...
 
class  SFCGAL::Solid
 A Solid modeled with an exteriorShell and interiorShells materialized by PolyhedralSurface. More...
 
class  SFCGAL::Triangle
 [OGC/SFA]Triangle More...
 
class  SFCGAL::TriangulatedSurface
 A TriangulatedSurface in SFA modeled as a Triangle soup. More...
 

Enumerations

enum  SFCGAL::GeometryType {
  SFCGAL::TYPE_POINT = 1 , SFCGAL::TYPE_LINESTRING = 2 , SFCGAL::TYPE_POLYGON = 3 , SFCGAL::TYPE_MULTIPOINT = 4 ,
  SFCGAL::TYPE_MULTILINESTRING = 5 , SFCGAL::TYPE_MULTIPOLYGON = 6 , SFCGAL::TYPE_GEOMETRYCOLLECTION = 7 , SFCGAL::TYPE_POLYHEDRALSURFACE = 15 ,
  SFCGAL::TYPE_TRIANGULATEDSURFACE = 16 , SFCGAL::TYPE_TRIANGLE = 100 , SFCGAL::TYPE_SOLID = 101 , SFCGAL::TYPE_MULTISOLID = 102
}
 [OGC/SFA]8.2.3 "A common list of codes for geometric types" More...
 
enum  SFCGAL::CoordinateType { SFCGAL::COORDINATE_XY = 0 , SFCGAL::COORDINATE_XYZ = 1000 , SFCGAL::COORDINATE_XYM = 2000 , SFCGAL::COORDINATE_XYZM = 3000 }
 coordinate types (XY, XYZ, XYM, etc.) More...
 

Functions

auto SFCGAL::algorithm::alphaShapes (const Geometry &g, double alpha=1, bool allow_holes=false) -> std::unique_ptr< Geometry >
 Compute the 2D alpha shapes for a geometry https://doc.cgal.org/latest/Alpha_shapes_2/index.html#Chapter_2D_Alpha_Shapes. More...
 
auto SFCGAL::algorithm::optimal_alpha_shapes (const Geometry &g, bool allow_holes=false, size_t nb_components=1) -> std::unique_ptr< Geometry >
 Compute the optimal 2D alpha shapes for a geometry https://doc.cgal.org/latest/Alpha_shapes_2/index.html#Chapter_2D_Alpha_Shapes. More...
 
auto SFCGAL::algorithm::area (const Geometry &g)
 Compute the 2D area for a Geometry. More...
 
auto SFCGAL::algorithm::area3D (const Geometry &g)
 Returns 3D area for a Geometry. More...
 
auto SFCGAL::algorithm::convexHull (const Geometry &g)
 Compute the 2D convex hull for a geometry. More...
 
auto SFCGAL::algorithm::convexHull3D (const Geometry &g)
 Compute the 3D convex hull for a geometry. More...
 
auto SFCGAL::algorithm::difference (const Geometry &ga, const Geometry &gb)
 Difference on 2D geometries. More...
 
auto SFCGAL::algorithm::difference3D (const Geometry &ga, const Geometry &gb)
 Difference on 3D geometries. More...
 
auto SFCGAL::algorithm::distance (const Geometry &gA, const Geometry &gB)
 Compute the distance between two Geometries. More...
 
auto SFCGAL::algorithm::distance3D (const Geometry &gA, const Geometry &gB)
 dispatch distance between two Geometries More...
 
auto SFCGAL::algorithm::extrude (const Geometry &g, Kernel::FT dx, Kernel::FT dy, Kernel::FT dz)
 Returns a Geometry equal to the specified Geometry, extruded by the specified displacement. More...
 
auto SFCGAL::algorithm::intersection (const Geometry &ga, const Geometry &gb)
 Intersection on 2D geometries. More...
 
auto SFCGAL::algorithm::intersection3D (const Geometry &ga, const Geometry &gb)
 Intersection on 3D geometries. More...
 
auto SFCGAL::algorithm::intersects (const Geometry &ga, const Geometry &gb)
 Robust intersection test on 2D geometries. More...
 
auto SFCGAL::algorithm::intersects3D (const Geometry &ga, const Geometry &gb)
 Robust intersection test on 3D geometries. More...
 
auto SFCGAL::algorithm::isValid (const Geometry &g, const double &toleranceAbs=1e-9)
 Check validity of a geometry. More...
 
void SFCGAL::algorithm::propagateValidityFlag (Geometry &g, bool valid)
 Sets the geometry flag on a geometry and propagate to every internal geometries. More...
 
auto SFCGAL::algorithm::minkowskiSum (const Geometry &gA, const Polygon &gB)
 2D minkowski sum (p+q) More...
 
auto SFCGAL::algorithm::offset (const Geometry &g, const double &r)
 [experimental]compute polygon offset More...
 
template<typename Kernel >
bool SFCGAL::algorithm::hasPlane3D (const Polygon &polygon, CGAL::Point_3< Kernel > &a, CGAL::Point_3< Kernel > &b, CGAL::Point_3< Kernel > &c)
 Test if a 3D plane can be extracted from a Polygon. More...
 
auto SFCGAL::algorithm::approximateMedialAxis (const Geometry &g)
 build an approximate medial axis for a Polygon More...
 
auto SFCGAL::algorithm::straightSkeleton (const Geometry &g, bool autoOrientation=true, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=1e-8)
 build a 2D straight skeleton for a Polygon More...
 
auto SFCGAL::algorithm::straightSkeleton (const Geometry &g, bool autoOrientation, NoValidityCheck, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=1e-8)
 build a 2D straight skeleton for a Polygon More...
 
auto SFCGAL::algorithm::tesselate (const Geometry &)
 Tesselate a geometry: this will triangulate surfaces (including polyhedral and solid's surfaces) and keep untouched points, lines, etc. More...
 
auto SFCGAL::algorithm::union_ (const Geometry &ga, const Geometry &gb)
 Union on 2D geometries. More...
 
auto SFCGAL::algorithm::union3D (const Geometry &ga, const Geometry &gb)
 Union on 3D geometries. More...
 
auto SFCGAL::algorithm::volume (const Geometry &g)
 Computes the volume of a geometry. More...
 

Detailed Description

Enumeration Type Documentation

◆ CoordinateType

coordinate types (XY, XYZ, XYM, etc.)

See also
SFA 2.8.3 LineStringZ = 1003 ( coordinateType + geometryType)
Enumerator
COORDINATE_XY 
COORDINATE_XYZ 
COORDINATE_XYM 
COORDINATE_XYZM 

◆ GeometryType

[OGC/SFA]8.2.3 "A common list of codes for geometric types"

Todo:
solid and triangles as non OGC/SFA geometric types?
Warning
codes for abstract classes and unimplemented classes are hidden
code values have are important for WKB
Enumerator
TYPE_POINT 
TYPE_LINESTRING 
TYPE_POLYGON 
TYPE_MULTIPOINT 
TYPE_MULTILINESTRING 
TYPE_MULTIPOLYGON 
TYPE_GEOMETRYCOLLECTION 
TYPE_POLYHEDRALSURFACE 
TYPE_TRIANGULATEDSURFACE 
TYPE_TRIANGLE 
TYPE_SOLID 
TYPE_MULTISOLID 

Function Documentation

◆ alphaShapes()

SFCGAL_API auto SFCGAL::algorithm::alphaShapes ( const Geometry g,
double  alpha = 1,
bool  allow_holes = false 
) -> std::unique_ptr< Geometry >

Compute the 2D alpha shapes for a geometry https://doc.cgal.org/latest/Alpha_shapes_2/index.html#Chapter_2D_Alpha_Shapes.

Since
1.4.1

◆ approximateMedialAxis()

SFCGAL_API std::unique_ptr< MultiLineString > SFCGAL::algorithm::approximateMedialAxis ( const Geometry g)

build an approximate medial axis for a Polygon

Parameters
ginput geometry
Precondition
g is a valid geometry
Exceptions
NotImplementedExceptionIf g is a Polygon with point touching rings.

◆ area()

SFCGAL_API double SFCGAL::algorithm::area ( const Geometry g)

Compute the 2D area for a Geometry.

Warning
Z component is ignored, there is no 2D projection for 3D geometries
Precondition
g is a valid geometry

◆ area3D()

SFCGAL_API double SFCGAL::algorithm::area3D ( const Geometry g)

Returns 3D area for a Geometry.

Warning
Solid area is set to 0 (might be defined as the area of the surface)
Precondition
g is a valid geometry

◆ convexHull()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::convexHull ( const Geometry g) -> std::unique_ptr< Geometry >

Compute the 2D convex hull for a geometry.

◆ convexHull3D()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::convexHull3D ( const Geometry g)

Compute the 3D convex hull for a geometry.

Todo:
improve to handle collinear points and coplanar points

◆ difference()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::difference ( const Geometry ga,
const Geometry gb 
)

Difference on 2D geometries.

Precondition
ga and gb are valid geometries

◆ difference3D()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::difference3D ( const Geometry ga,
const Geometry gb 
)

Difference on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries

◆ distance()

SFCGAL_API double SFCGAL::algorithm::distance ( const Geometry gA,
const Geometry gB 
)

Compute the distance between two Geometries.

Precondition
gA is a valid geometry
gB is a valid geometry

◆ distance3D()

SFCGAL_API double SFCGAL::algorithm::distance3D ( const Geometry gA,
const Geometry gB 
)

dispatch distance between two Geometries

Todo:
complete with solid Compute distance between two 3D Geometries
Precondition
gA is a valid geometry
gB is a valid geometry

◆ extrude()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::extrude ( const Geometry g,
Kernel::FT  dx,
Kernel::FT  dy,
Kernel::FT  dz 
)

Returns a Geometry equal to the specified Geometry, extruded by the specified displacement.

Parameters
gThe specified Geometry.
dxThe component of the specified displacement in the x-direction.
dyThe component of the specified displacement in the y-direction.
dzThe component of the specified displacement in the z-direction.
Returns
A Geometry equal to g extruded by the displacement vector {dx, dy, dz}.
Precondition
g must be a valid geometry.
dx, dy and dz must all be finite.
Note
If g is such that g.isMeasured() is true, then, since there is no common expectation of the values of the measures on the returned Geometry, all measures from the result are removed.

◆ hasPlane3D()

template<typename Kernel >
bool SFCGAL::algorithm::hasPlane3D ( const Polygon polygon,
CGAL::Point_3< Kernel > &  a,
CGAL::Point_3< Kernel > &  b,
CGAL::Point_3< Kernel > &  c 
)

Test if a 3D plane can be extracted from a Polygon.

◆ intersection()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::intersection ( const Geometry ga,
const Geometry gb 
)

Intersection on 2D geometries.

Precondition
ga and gb are valid geometries

◆ intersection3D()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::intersection3D ( const Geometry ga,
const Geometry gb 
)

Intersection on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries

◆ intersects()

SFCGAL_API bool SFCGAL::algorithm::intersects ( const Geometry ga,
const Geometry gb 
)

Robust intersection test on 2D geometries.

Force projection to z=0 if needed

Precondition
ga and gb are valid geometries

◆ intersects3D()

SFCGAL_API bool SFCGAL::algorithm::intersects3D ( const Geometry ga,
const Geometry gb 
)

Robust intersection test on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries

◆ isValid()

SFCGAL_API const Validity SFCGAL::algorithm::isValid ( const Geometry g,
const double &  toleranceAbs 
) -> const Validity

Check validity of a geometry.

◆ minkowskiSum()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::minkowskiSum ( const Geometry gA,
const Polygon gB 
)

2D minkowski sum (p+q)

Warning
If gA is a polygon, its orientation is taken into account. A "reversed" polygon (with a clockwise-oriented exterior ring) will involve a minkowski difference rather than a sum.
Todo:
missing cases (union)
Precondition
gA and gB are valid geometries

◆ offset()

SFCGAL_API std::unique_ptr< MultiPolygon > SFCGAL::algorithm::offset ( const Geometry g,
const double &  r 
)

[experimental]compute polygon offset

Warning
test in order to compare with minkowski sum
Precondition
g is a valid Geometry

◆ optimal_alpha_shapes()

SFCGAL_API auto SFCGAL::algorithm::optimal_alpha_shapes ( const Geometry g,
bool  allow_holes = false,
size_t  nb_components = 1 
) -> std::unique_ptr< Geometry >

Compute the optimal 2D alpha shapes for a geometry https://doc.cgal.org/latest/Alpha_shapes_2/index.html#Chapter_2D_Alpha_Shapes.

Since
1.4.1

◆ propagateValidityFlag()

SFCGAL_API void SFCGAL::algorithm::propagateValidityFlag ( Geometry g,
bool  valid 
)

Sets the geometry flag on a geometry and propagate to every internal geometries.

◆ straightSkeleton() [1/2]

SFCGAL_API std::unique_ptr< MultiLineString > SFCGAL::algorithm::straightSkeleton ( const Geometry g,
bool  autoOrientation,
NoValidityCheck  ,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = 1e-8 
)

build a 2D straight skeleton for a Polygon

Parameters
ginput geometry
autoOrientationcheck and fix polygon orientation
outputMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points. A line must have a maximum distance of toleranceAbs.
Precondition
g is a valid geometry
Warning
No actual validity check is done
Exceptions
NotImplementedExceptionIf g is a Polygon with point touching rings.

◆ straightSkeleton() [2/2]

SFCGAL_API std::unique_ptr< MultiLineString > SFCGAL::algorithm::straightSkeleton ( const Geometry g,
bool  autoOrientation = true,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = 1e-8 
)

build a 2D straight skeleton for a Polygon

Todo:
add supports for TriangulatedSurface and PolyhedralSurface
Parameters
ginput geometry
autoOrientationcheck and fix polygon orientation
outputMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points. A line must have a maximum distance of toleranceAbs.
Precondition
g is a valid geometry
Exceptions
NotImplementedExceptionIf g is a Polygon with point touching rings.

◆ tesselate()

SFCGAL_API std::unique_ptr< SFCGAL::Geometry > SFCGAL::algorithm::tesselate ( const Geometry )

Tesselate a geometry: this will triangulate surfaces (including polyhedral and solid's surfaces) and keep untouched points, lines, etc.

Precondition
g is a valid geometry

◆ union3D()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::union3D ( const Geometry ga,
const Geometry gb 
)

Union on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries

◆ union_()

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::union_ ( const Geometry ga,
const Geometry gb 
)

Union on 2D geometries.

Precondition
ga and gb are valid geometries

◆ volume()

SFCGAL_API const Kernel::FT SFCGAL::algorithm::volume ( const Geometry g)

Computes the volume of a geometry.

Precondition
g is a valid Geometry