SFCGAL  2.3.0
Namespaces | Classes | Enumerations | Functions
SFCGAL::algorithm Namespace Reference

Compute the topological boundary of a Geometry. More...

Namespaces

 detail
 

Classes

class  BoundaryVisitor
 Compute the boundary for a Geometry. More...
 
class  Buffer3D
 Computes a 3D buffer around a Point or LineString. More...
 
struct  ChamferOptions
 Options for chamfer/fillet operations. More...
 
class  Closure
 Result type for closure check. More...
 
class  ConsistentOrientationBuilder
 Make orientation consistent in a triangle set. More...
 
class  EqualityStrictness
 Manages how geometry comparison will be handled. More...
 
struct  Frame
 Right-handed orthonormal basis at a point on the sweep path. More...
 
struct  NoValidityCheck
 Tag used for variants of algorithm that do not do validity check. More...
 
struct  Plane3DInexactUnsafe
 
struct  RoofParameters
 Parameters for roof generation algorithms. More...
 
struct  SimplificationStopPredicate
 Stop predicate for surface mesh simplification. More...
 
class  SurfaceGraph
 Represents a polyhedral surface as a graph where faces are nodes and egde are graph edges. More...
 
struct  SweepOptions
 Options for controlling sweep operation behavior. More...
 
class  WeightedCentroid
 Holds weighted data used to compute a centroid for a Geometry. More...
 

Typedefs

using Point_3 = Kernel::Point_3
 
using Vector_3 = Kernel::Vector_3
 
using Surface_mesh_3 = SFCGAL::Surface_mesh_3
 
using FaceIndex = Surface_mesh_3::Face_index
 
using HalfedgeIndex = Surface_mesh_3::Halfedge_index
 
using VertexIndex = Surface_mesh_3::Vertex_index
 
using Straight_skeleton_2 = CGAL::Straight_skeleton_2< Kernel >
 
using Arrangement_2 = CGAL::Arrangement_2< CGAL::Arr_segment_traits_2< Kernel >>
 
template<class T >
using SHARED_PTR = boost::shared_ptr< T >
 

Enumerations

enum  ChamferType : std::uint8_t { ChamferType::FLAT, ChamferType::ROUND }
 Type of chamfer operation. More...
 
enum  PartitionAlgorithm { y_monotone, approx_convex, greene_approx_convex, optimal_convex }
 Partition algorithm available. More...
 
enum  RoofType : std::uint8_t { RoofType::FLAT, RoofType::HIPPED, RoofType::SKILLION, RoofType::GABLE }
 Enumeration of roof types supported by the roof generation algorithms. More...
 
enum  SimplificationStrategy : unsigned char { SimplificationStrategy::EDGE_LENGTH }
 Strategy for surface mesh simplification cost and placement. More...
 

Functions

auto optimalAlphaShapes (const Geometry &geometry, bool allowHoles=false, size_t nbComponents=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 alphaShapes (const Geometry &geometry, double alpha=1, bool allowHoles=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 area (const Geometry &geom, [[maybe_unused]] NoValidityCheck noCheck) -> double
 
auto area (const Geometry &geom) -> double
 Compute the 2D area of a Geometry. More...
 
auto signedArea (const Triangle &triangle) -> Kernel::FT
 Computes the 2D signed area of a Triangle. More...
 
auto signedArea (const LineString &lineString) -> Kernel::FT
 Computes the 2D signed area of a LineString. More...
 
auto area (const Triangle &triangle) -> double
 Computes the 2D area of a Triangle. More...
 
auto area (const Polygon &polygon) -> double
 Computes the 2D area of a Polygon. More...
 
auto area (const GeometryCollection &collection) -> double
 Computes the 2D area of a GeometryCollection. More...
 
auto area (const TriangulatedSurface &tin) -> double
 Computes the 2D area of a TriangulatedSurface. More...
 
auto area (const PolyhedralSurface &surface) -> double
 Computes the 2D area of a PolyhedralSurface. More...
 
auto area3D (const Geometry &geom, [[maybe_unused]] NoValidityCheck noCheck) -> double
 
auto area3D (const Geometry &geom) -> double
 Compute the 3D area of a Geometry. More...
 
auto area3D (const Polygon &polygon) -> double
 Compute the 3D area of a Polygon. More...
 
auto area3D (const Triangle &triangle) -> double
 Compute the 3D area of a Triangle. More...
 
auto area3D (const GeometryCollection &collection) -> double
 Compute the 3D area of a GeometryCollection. More...
 
auto area3D (const PolyhedralSurface &surface) -> double
 Compute the 3D area of a PolyhedralSurface. More...
 
auto area3D (const TriangulatedSurface &tin) -> double
 Compute the 3D area of a TriangulatedSurface. More...
 
SFCGAL_API auto area (const Geometry &geom, NoValidityCheck noCheck) -> double
 Compute the planar (2D) area of a Geometry without performing validity checks. More...
 
SFCGAL_API auto area3D (const Geometry &geom, NoValidityCheck noCheck) -> double
 Compute the 3D surface area of a geometry, dispatching by geometry type. More...
 
template<typename GeometryIterator >
std::unique_ptr< Geometry > collect (GeometryIterator begin, GeometryIterator end)
 Returns an aggregate of a list of geometries. More...
 
template<int Dim>
auto covers (const detail::PrimitiveHandle< Dim > &handle1, const detail::PrimitiveHandle< Dim > &handle2) -> bool
 Cover test on PrimitiveHandle objects. More...
 
auto distance (const Geometry &geometry1, const Geometry &geometry2) -> double
 Compute 2D distance between two geometries. More...
 
SFCGAL_API auto distance (const Geometry &geometry1, const Geometry &geometry2, NoValidityCheck noCheck) -> double
 Dispatch distance between two Geometries. More...
 
auto distance3D (const Geometry &gA, const Geometry &gB) -> double
 Compute 3D distance between two geometries. More...
 
SFCGAL_API auto distance3D (const Geometry &geometry1, const Geometry &geometry2, NoValidityCheck noCheck) -> double
 Dispatch 3D distance between two Geometries. More...
 
auto almostEqual (const Geometry &geomA, const Geometry &geomB, double tolerance, EqualityStrictness strictness) -> bool
 end of private section More...
 
SFCGAL_API auto extrude (const Geometry &inputGeom, const Kernel::FT &displacementX, const Kernel::FT &displacementY, const Kernel::FT &displacementZ, NoValidityCheck &nvc) -> std::unique_ptr< Geometry >
 Extrude geometry without validity check. More...
 
void force2D (Geometry &g)
 force a geometry to be 2D (project on O,x,y) More...
 
void force3D (Geometry &g, const Kernel::FT &defaultZ=0)
 force a 2D geometry to be 3D (replace undefined Z by defaultZ, existing Z values remains unchanged) More...
 
void forceMeasured (Geometry &geometry, const double &defaultM=0)
 force a 2D or M geometry to be M (replace undefined M by defaultM, existing M values remains unchanged) More...
 
void extractPoints (const Geometry &geometry, std::vector< Point > &points)
 Extract all points from a geometry using GetPointsVisitor. More...
 
auto findInsertionPosition (const LineString &lineString, const Point &point) -> size_t
 Find the insertion position for a point on a linestring. More...
 
auto insertPointIntoLineString (const LineString &lineString, const Point &point, size_t position) -> std::unique_ptr< LineString >
 Insert a point into a linestring at a specific position. More...
 
auto insertPointsIntoLineString (const LineString &lineString, const std::vector< Point > &points, double tolerance) -> std::unique_ptr< LineString >
 Insert points into a linestring based on distance tolerance. More...
 
auto insertPointsWithinTolerance (const Geometry &baseGeometry, const Geometry &sourceGeometry, double tolerance=EPSILON) -> std::unique_ptr< Geometry >
 Inserts points from sourceGeometry into baseGeometry within a given tolerance. More...
 
template<int Dim>
auto intersection (const detail::GeometrySet< Dim > &geometrySet1, const detail::GeometrySet< Dim > &geometrySet2, detail::GeometrySet< Dim > &result) -> void
 Intersection between two geometry sets. More...
 
template<int Dim>
auto intersection (const detail::PrimitiveHandle< Dim > &primitiveHandle1, const detail::PrimitiveHandle< Dim > &primitiveHandle2, detail::GeometrySet< Dim > &result) -> void
 Intersection between two primitive handles. More...
 
auto isClosed (const Geometry &geometry) -> Closure
 Check if a geometry is closed. More...
 
auto length (const LineString &g) -> double
 Compute the 2D length for a LineString. More...
 
auto length (const GeometryCollection &g) -> double
 Compute the 2D length for a GeometryCollection. More...
 
auto length (const Geometry &g) -> double
 Compute the 2D length for a Geometry (0 for incompatible types) More...
 
auto length3D (const LineString &g) -> double
 Compute the 3D length for a LineString. More...
 
auto length3D (const GeometryCollection &g) -> double
 Compute the 3D length for a GeometryCollection. More...
 
auto length3D (const Geometry &g) -> double
 Compute the 3D length for a geometry. More...
 
template<typename Kernel >
auto normal3D (const CGAL::Point_3< Kernel > &point1, const CGAL::Point_3< Kernel > &point2, const CGAL::Point_3< Kernel > &point3) -> CGAL::Vector_3< Kernel >
 Returns the 3D normal to 3 consecutive points. More...
 
template<typename Kernel >
auto normal3D (const LineString &lineString, bool exact=true) -> CGAL::Vector_3< Kernel >
 Returns the 3D normal to a ring (supposed to be planar and closed). More...
 
template<typename Kernel >
auto normal3D (const Polygon &polygon, bool exact=true) -> CGAL::Vector_3< Kernel >
 Returns the 3D normal to a polygon (supposed to be planar). More...
 
SFCGAL_API std::unique_ptr< MultiPolygon > offset (const Geometry &geometry, const double &radius)
 [experimental]compute polygon offset More...
 
SFCGAL_API std::unique_ptr< MultiPolygon > offset (const Geometry &geometry, const double &radius, NoValidityCheck)
 [experimental]compute polygon offset More...
 
auto makeValidOrientation (CGAL::Polygon_2< Kernel > &polygon) -> void
 Make valid 2D orientation. More...
 
auto makeValidOrientation (CGAL::Polygon_with_holes_2< Kernel > &polygon) -> void
 Make valid 2D orientation. More...
 
auto makeValidOrientation (Polygon &polygon) -> void
 Make valid 2D orientation. More...
 
auto makeConsistentOrientation3D (TriangulatedSurface &g) -> void
 Try to make consistent orientation in a TriangulatedSurface. More...
 
auto partition_2 (const Geometry &geometry, PartitionAlgorithm algorithm, NoValidityCheck) -> std::unique_ptr< Geometry >
 Compute the partition of a 2D polygon https://doc.cgal.org/latest/Partition_2/index.html#Chapter_2D_Polygon_Partitioning. More...
 
auto partition_2 (const Geometry &geometry, PartitionAlgorithm algorithm=y_monotone) -> std::unique_ptr< Geometry >
 Compute the partition of a 2D polygon https://doc.cgal.org/latest/Partition_2/index.html#Chapter_2D_Polygon_Partitioning. More...
 
template<typename Kernel >
auto hasPlane3D (const Polygon &polygon, CGAL::Point_3< Kernel > &pointA, CGAL::Point_3< Kernel > &pointB, CGAL::Point_3< Kernel > &pointC) -> bool
 Test if a 3D plane can be extracted from a Polygon. More...
 
template<typename Kernel >
auto hasPlane3D (const Polygon &polygon) -> bool
 Test if a 3D plane can be extracted from a Polygon. More...
 
template<typename Kernel >
auto plane3D (const Polygon &polygon, CGAL::Point_3< Kernel > &pointA, CGAL::Point_3< Kernel > &pointB, CGAL::Point_3< Kernel > &pointC) -> void
 Get 3 non collinear points from a Polygon. More...
 
template<typename Kernel >
auto plane3D (const Polygon &polygon) -> CGAL::Plane_3< Kernel >
 Returns the oriented 3D plane of a polygon (supposed to be planar). More...
 
template<typename Kernel >
auto plane3D (const Polygon &polygon, const Plane3DInexactUnsafe &) -> CGAL::Plane_3< Kernel >
 Returns the oriented 3D plane of a polygon (supposed to be planar) - inexact version. More...
 
template<typename Kernel >
auto plane3D (const Polygon &polygon, bool exact) -> CGAL::Plane_3< Kernel >
 Returns the oriented 3D plane of a polygon (supposed to be planar). More...
 
template<typename Kernel >
auto isPlane3D (const Geometry &geom, const double &toleranceAbs) -> bool
 Test if all points of a geometry lie in the same plane. More...
 
auto extrudeGableRoof (const Polygon &polygon, double clippingHeight, double slopeAngle=45.0) -> std::unique_ptr< PolyhedralSurface >
 Gable roof generation (Surface only). More...
 
auto extrudeSkillionRoof (const Polygon &polygon, double clippingHeight, size_t primaryEdgeIndex=0, double primaryAngle=30.0, double secondaryAngle=90.0) -> std::unique_ptr< PolyhedralSurface >
 Skillion roof generation (Surface only). More...
 
auto generateRoof (const Polygon &footprint, const RoofParameters &params) -> std::unique_ptr< Geometry >
 Generate a roof using unified parameters. More...
 
auto generateRoof (const Polygon &footprint, const RoofParameters &params, NoValidityCheck &nvc) -> std::unique_ptr< Geometry >
 Generate a roof using unified parameters without validity check. More...
 
void rotate (Geometry &geometry, const Kernel::FT &angle)
 Rotate a geometry in 2D around the origin (0,0) More...
 
void rotate (Geometry &geometry, const Kernel::FT &angle, const Point &origin)
 Rotate a geometry in 2D around a specified point. More...
 
void rotate (Geometry &geometry, const Kernel::FT &angle, const Kernel::Vector_3 &axis, const Point &origin=Point(0, 0, 0))
 Rotate a geometry in 3D around a specified axis and origin. More...
 
void rotateX (Geometry &geometry, const Kernel::FT &angle)
 Rotate a geometry around the X axis. More...
 
void rotateY (Geometry &geometry, const Kernel::FT &angle)
 Rotate a geometry around the Y axis. More...
 
void rotateZ (Geometry &geometry, const Kernel::FT &angle)
 Rotate a geometry around the Z axis. More...
 
void scale (Geometry &geometry, double scaleFactor)
 Scale a geometry by a given factor. More...
 
void scale (Geometry &geometry, double sx, double sy, double sz=0.0)
 Scale a geometry by different factors for each dimension. More...
 
void scale (Geometry &geometry, double sx, double sy, double sz, double cx, double cy, double cz)
 Scale a geometry by different factors for each dimension around a center point. More...
 
auto simplify (const Geometry &geometry, double threshold, bool preserveTopology) -> std::unique_ptr< Geometry >
 Main entry point for geometry simplification. More...
 
auto simplify (const Geometry &geometry, double threshold, bool preserveTopology, NoValidityCheck) -> std::unique_ptr< Geometry >
 Simplifies a geometry using the CGAL algorithm https://doc.cgal.org/latest/Polyline_simplification_2/index.html. More...
 
SFCGAL_API auto split3D (const Geometry &geometry, const Point &planePoint, const Kernel::Vector_3 &planeNormal, bool closeGeometries=false) -> std::unique_ptr< GeometryCollection >
 Split the given geometry with a plane defined by a point and a normal vector. More...
 
auto straightSkeleton (const Geometry &geom, bool autoOrientation, NoValidityCheck, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=EPSILON) -> std::unique_ptr< MultiLineString >
 build a 2D straight skeleton for a Polygon More...
 
auto straightSkeleton (const Geometry &geom, bool autoOrientation=true, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=EPSILON) -> std::unique_ptr< MultiLineString >
 build a 2D straight skeleton for a Polygon More...
 
auto straightSkeleton (const Polygon &geom, bool autoOrientation=true, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=EPSILON) -> std::unique_ptr< MultiLineString >
 build a 2D straight skeleton for a Polygon More...
 
auto straightSkeleton (const MultiPolygon &geom, bool autoOrientation=true, bool innerOnly=false, bool outputDistanceInM=false, const double &toleranceAbs=EPSILON) -> std::unique_ptr< MultiLineString >
 build a 2D straight skeleton for a Polygon More...
 
auto approximateMedialAxis (const Geometry &geom, bool projectToEdges=false) -> std::unique_ptr< MultiLineString >
 build an approximate medial axis for a Polygon More...
 
auto straightSkeletonPartition (const Geometry &geom, bool autoOrientation=true) -> std::unique_ptr< PolyhedralSurface >
 Build a 2D straight skeleton partition for a Geometry. More...
 
auto straightSkeletonPartition (const MultiPolygon &geom, bool autoOrientation=true) -> std::unique_ptr< PolyhedralSurface >
 Build a 2D straight skeleton partition for a MultiPolygon. More...
 
auto straightSkeletonPartition (const Polygon &geom, bool autoOrientation=true) -> std::unique_ptr< PolyhedralSurface >
 Build a 2D straight skeleton partition for a Polygon. More...
 
auto surfaceSimplification (const Geometry &geometry, const SimplificationStopPredicate &stopPredicate, SimplificationStrategy strategy) -> std::unique_ptr< Geometry >
 Simplify a surface mesh using CGAL edge collapse algorithm. More...
 
auto surfaceSimplification (const Geometry &geometry, const SimplificationStopPredicate &stopPredicate, SimplificationStrategy strategy, NoValidityCheck noCheck) -> std::unique_ptr< Geometry >
 Simplify a surface mesh using CGAL edge collapse algorithm (no validity check) More...
 
auto tessellate (const Geometry &g, NoValidityCheck) -> std::unique_ptr< Geometry >
 Tessellate geometry without validity check. More...
 
auto tessellate (const Geometry &g) -> std::unique_ptr< Geometry >
 Tessellate geometry. More...
 
void translate (Geometry &geometry, const Kernel::Vector_3 &vector)
 translate a geometry from a given vector More...
 
void translate (Geometry &geometry, const Kernel::Vector_2 &vector)
 translate a geometry from a given vector More...
 
void translate (Geometry &geometry, const Kernel::FT &dx, const Kernel::FT &dy, const Kernel::FT &dz)
 translate a geometry from a given vector More...
 
void translate (Geometry &geometry, const double &dx, const double &dy, const double &dz)
 translate a geometry from double-coordinates More...
 
template<int Dim>
void union_ (const detail::GeometrySet< Dim > &geometrySet1, const detail::GeometrySet< Dim > &geometrySet2, detail::GeometrySet< Dim > &result)
 Compute union of two GeometrySet objects. More...
 
template<int Dim>
void union_ (const detail::PrimitiveHandle< Dim > &primitiveHandle1, const detail::PrimitiveHandle< Dim > &primitiveHandle2, detail::GeometrySet< Dim > &result)
 Compute union of two PrimitiveHandle objects. More...
 
auto visibility (const Geometry &polygon, const Geometry &point) -> std::unique_ptr< Polygon >
 build the visibility polygon of a Point inside a Polygon More...
 
auto visibility (const Geometry &polygon, const Geometry &point, NoValidityCheck) -> std::unique_ptr< Polygon >
 build the visibility polygon of a Point inside a Polygon More...
 
auto visibility (const Geometry &polygon, const Geometry &pointA, const Geometry &pointB) -> std::unique_ptr< Polygon >
 build the visibility polygon of the segment [pointA ; pointB] on a Polygon More...
 
auto visibility (const Geometry &polygon, const Geometry &pointA, const Geometry &pointB, NoValidityCheck) -> std::unique_ptr< Polygon >
 build the visibility polygon of a Point inside a Polygon More...
 
auto volume (const PolyhedralSurface &surface, NoValidityCheck noValidityCheck=NoValidityCheck()) -> Kernel::FT
 Calculate the volume of a closed PolyhedralSurface. More...
 
auto volume (const Solid &solid, NoValidityCheck noValidityCheck=NoValidityCheck()) -> Kernel::FT
 Calculate the volume of a Solid. More...
 
auto volume (const Geometry &g) -> Kernel::FT
 Calculate the volume of any geometry. More...
 
using InexactKernel = CGAL::Exact_predicates_inexact_constructions_kernel
 
using Inexact_Point_3 = InexactKernel::Point_3
 
using Mesh = CGAL::Surface_mesh< Inexact_Point_3 >
 
using ExactMesh = CGAL::Surface_mesh< Kernel::Point_3 >
 
using EK_to_IK = CGAL::Cartesian_converter< Kernel, InexactKernel >
 
using IK_to_EK = CGAL::Cartesian_converter< InexactKernel, Kernel >
 
template<typename T >
std::function< WeightedCentroid(const T &, bool)> weightedCentroidLambda
 
using NoVolume = detail::NoVolume
 
using MarkedPolyhedron = detail::MarkedPolyhedron
 
using FaceBboxBase = CGAL::Box_intersection_d::Box_with_handle_d< double, 3, MarkedPolyhedron::Halfedge_around_facet_const_circulator >
 
using Polyline_3 = std::vector< Kernel::Point_3 >
 
using Traits = CGAL::Partition_traits_2< Kernel >
 
using TPoint_2 = Traits::Point_2
 
using TPolygon_2 = Traits::Polygon_2
 

Detailed Description

Compute the topological boundary of a Geometry.

Main algorithm namespace.

This visitor computes the boundary for various geometry types:

GeometryCollection handling is limited and not supported in the general, heterogeneous case.

The computed boundary is stored internally and returned via releaseBoundary().

Warning
GeometryCollection is not supported in the general case.
Todo:
Improve support for Solid, MultiPolygon, PolyhedralSurface, TriangulatedSurface and heterogeneous GeometryCollection.

Typedef Documentation

using SFCGAL::algorithm::Arrangement_2 = typedef CGAL::Arrangement_2<CGAL::Arr_segment_traits_2<Kernel>>
using SFCGAL::algorithm::EK_to_IK = typedef CGAL::Cartesian_converter<Kernel, InexactKernel>
using SFCGAL::algorithm::ExactMesh = typedef CGAL::Surface_mesh<Kernel::Point_3>
using SFCGAL::algorithm::FaceBboxBase = typedef CGAL::Box_intersection_d::Box_with_handle_d< double, 3, MarkedPolyhedron::Halfedge_around_facet_const_circulator>
using SFCGAL::algorithm::FaceIndex = typedef Surface_mesh_3::Face_index
using SFCGAL::algorithm::HalfedgeIndex = typedef Surface_mesh_3::Halfedge_index
using SFCGAL::algorithm::IK_to_EK = typedef CGAL::Cartesian_converter<InexactKernel, Kernel>
using SFCGAL::algorithm::Inexact_Point_3 = typedef InexactKernel::Point_3
using SFCGAL::algorithm::InexactKernel = typedef CGAL::Exact_predicates_inexact_constructions_kernel
using SFCGAL::algorithm::Mesh = typedef CGAL::Surface_mesh<Inexact_Point_3>
using SFCGAL::algorithm::Point_3 = typedef Kernel::Point_3
using SFCGAL::algorithm::Polyline_3 = typedef std::vector<Kernel::Point_3>
template<class T >
using SFCGAL::algorithm::SHARED_PTR = typedef boost::shared_ptr<T>
using SFCGAL::algorithm::Straight_skeleton_2 = typedef CGAL::Straight_skeleton_2<Kernel>
using SFCGAL::algorithm::TPoint_2 = typedef Traits::Point_2
using SFCGAL::algorithm::TPolygon_2 = typedef Traits::Polygon_2
using SFCGAL::algorithm::Traits = typedef CGAL::Partition_traits_2<Kernel>
using SFCGAL::algorithm::Vector_3 = typedef Kernel::Vector_3
typedef Surface_mesh_3::Vertex_index SFCGAL::algorithm::VertexIndex

Enumeration Type Documentation

enum SFCGAL::algorithm::ChamferType : std::uint8_t
strong

Type of chamfer operation.

A chamfer removes material along a sharp edge of a solid.

  • FLAT: Replaces the edge with a single planar face (a bevel).
  • ROUND: Replaces the edge with a smooth curved surface (a fillet), approximated by a series of planar facets.
Enumerator
FLAT 

Flat chamfer: single planar bevel.

ROUND 

Rounded fillet: circular-arc surface (approximated)

Partition algorithm available.

Since
1.4.2
Enumerator
y_monotone 

Y Monotone Partition: https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_monotone

approx_convex 

Simple approximation algorithm of Hertel and Mehlhorn https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex

greene_approx_convex 

Sweep-line approximation algorithm of Greene https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex

optimal_convex 

Optimal convex partition https://doc.cgal.org/latest/Partition_2/index.html#secpartition_2_convex

enum SFCGAL::algorithm::RoofType : std::uint8_t
strong

Enumeration of roof types supported by the roof generation algorithms.

Enumerator
FLAT 

Flat roof (simple extrusion)

HIPPED 

Hipped roof (straight skeleton extrusion)

SKILLION 

Skillion roof (alias for pitched roof)

GABLE 

Gable roof (dual symmetric slopes)

enum SFCGAL::algorithm::SimplificationStrategy : unsigned char
strong

Strategy for surface mesh simplification cost and placement.

Defines the method used to calculate edge collapse cost and vertex placement during surface mesh simplification. Each strategy has different computational characteristics and memory requirements:

  • EDGE_LENGTH: O(E log E) complexity, low memory, exact arithmetic
  • GARLAND_HECKBERT: O(E log E) complexity, higher memory, inexact arithmetic
  • LINDSTROM_TURK: O(E log E) complexity, higher memory, inexact arithmetic

Advanced strategies require Eigen support and automatically convert between exact and inexact kernels for optimal performance. during surface mesh simplification. Advanced strategies require Eigen support.

Enumerator
EDGE_LENGTH 

Edge Length strategy.

Uses edge length as cost function and midpoint placement for vertex positioning. This strategy is compatible with exact kernels and provides good simplification results while maintaining geometric accuracy.

Computational characteristics:

  • Time complexity: O(E log E) where E is the number of edges
  • Space complexity: O(V + E) where V is the number of vertices
  • Kernel: Exact predicates and constructions
  • Memory overhead: Minimal
  • Best for: General purpose simplification with exact results
See also
https://doc.cgal.org/latest/Surface_mesh_simplification/index.html
Examples:
/tmp/B.oxclwyi3/BUILD/SFCGAL-2.3.0-build/SFCGAL-v2.3.0/src/algorithm/surfaceSimplification.h.

Function Documentation

SFCGAL_API auto SFCGAL::algorithm::almostEqual ( const Geometry &  geomA,
const Geometry &  geomB,
double  tolerance,
EqualityStrictness  strictness = EqualityStrictness::allPointOrdered() 
) -> bool

end of private section

Equality operator.

Precondition
the two geometries must be valid
Parameters
geomAgeometry to compare with
geomBgeometry to compare with
toleranceallowed distance between same points.
strictnesswill refer to EqualityStrictness flags. Default: EqualityStrictness::allPointOrdered()
Returns
true when 2 geometries are valid against strictness value and tolerance
SFCGAL_API auto SFCGAL::algorithm::alphaShapes ( const Geometry &  geometry,
double  alpha = 1,
bool  allowHoles = 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.

Parameters
geometrythe input geometry
alphathe alpha value (default: 1)
allowHoleswhether to allow holes in the result (default: false)
Returns
the computed alpha shapes as a unique_ptr<Geometry>
Since
1.4.1
SFCGAL_API auto SFCGAL::algorithm::approximateMedialAxis ( const Geometry &  geom,
bool  projectToEdges = false 
) -> std::unique_ptr< MultiLineString >

build an approximate medial axis for a Polygon

Parameters
geominput geometry
projectToEdgesif true, project free endpoints to polygon boundary using edge midpoint method
Returns
approximate medial axis as a MultiLineString
Precondition
geom is a valid geometry
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.

When projectToEdges is true, free endpoints of the medial axis are extended to the polygon boundary. The projection uses the midpoint of the common defining edge from the straight skeleton, providing a geometrically exact and symmetric result.

auto SFCGAL::algorithm::area ( const Geometry &  geom,
[[maybe_unused] ] NoValidityCheck  noCheck 
) -> double
SFCGAL_API auto SFCGAL::algorithm::area ( const Geometry &  geom,
NoValidityCheck  noCheck 
) -> double

Compute the planar (2D) area of a Geometry without performing validity checks.

Dispatches on the runtime geometry type:

  • Returns 0 for POINT, LINESTRING, NURBSCURVE, SOLID and MULTISOLID.
  • Delegates to specialized overloads for POLYGON, TRIANGLE, TRIANGULATEDSURFACE, POLYHEDRALSURFACE and collections (MULTI and GEOMETRYCOLLECTION types).
Warning
Z component is ignored, there is no 2D projection for 3D geometries
No actual validity check is done
Precondition
The input geometry geom must be valid.
Parameters
geomThe geometry whose planar area is computed.
noCheckUnused tag parameter indicating that geometry validity is not checked.
Returns
double The computed planar area (>= 0).
Exceptions
ExceptionIf the geometry type is not handled by this dispatch.
SFCGAL_API auto SFCGAL::algorithm::area ( const Geometry &  geom) -> double

Compute the 2D area of a Geometry.

Warning
Z component is ignored, there is no 2D projection for 3D geometries
Precondition
The input geometry geom must be a valid geometry instance.
Parameters
geomThe input geometry.
Returns
The 2D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area ( const Triangle &  triangle) -> double

Computes the 2D area of a Triangle.

Parameters
triangleThe input Triangle.
Returns
The total area of the triangle.
SFCGAL_API auto SFCGAL::algorithm::area ( const Polygon &  polygon) -> double

Computes the 2D area of a Polygon.

Parameters
polygonThe input Polygon.
Returns
The total area of the polygon.
SFCGAL_API auto SFCGAL::algorithm::area ( const GeometryCollection &  collection) -> double

Computes the 2D area of a GeometryCollection.

Parameters
collectionThe input GeometryCollection.
Returns
The total area of the collection.
SFCGAL_API auto SFCGAL::algorithm::area ( const TriangulatedSurface &  tin) -> double

Computes the 2D area of a TriangulatedSurface.

Parameters
tinThe input TriangulatedSurface.
Returns
The total area of the TriangulatedSurface.
SFCGAL_API auto SFCGAL::algorithm::area ( const PolyhedralSurface &  surface) -> double

Computes the 2D area of a PolyhedralSurface.

Parameters
surfaceThe input PolyhedralSurface.
Returns
The total area of the PolyhedralSurface.
auto SFCGAL::algorithm::area3D ( const Geometry &  geom,
[[maybe_unused] ] NoValidityCheck  noCheck 
) -> double
SFCGAL_API auto SFCGAL::algorithm::area3D ( const Geometry &  geom,
NoValidityCheck  noCheck 
) -> double

Compute the 3D surface area of a geometry, dispatching by geometry type.

This overload assumes validity checks have already been performed (the NoValidityCheck parameter is present to select this unchecked path) and returns the 3D area in the geometry's own coordinate space.

Warning
Solid area is set to 0 (might be defined as the area of the surface)
No actual validity check is done
Precondition
geom is a valid geometry

Behavior by geometry type:

  • POINT, LINESTRING, NURBSCURVE, SOLID, MULTISOLID: return 0.
  • POLYGON, TRIANGLE, TRIANGULATEDSURFACE, POLYHEDRALSURFACE: delegate to the corresponding area3D(...) function for that type.
  • MULTI types and GEOMETRYCOLLECTION: sum the 3D area of contained geometries.
Parameters
geomGeometry to measure.
noCheckUnused tag parameter selecting the unchecked path.
Returns
double 3D surface area of the geometry.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const Geometry &  geom) -> double

Compute the 3D area of a Geometry.

Warning
Solid area is set to 0 (might be defined as the area of the surface)
Precondition
The input geometry geom must be a valid geometry instance.
Parameters
geomThe input geometry.
Returns
The 3D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const Polygon &  polygon) -> double

Compute the 3D area of a Polygon.

Precondition
The input geometry polygon must be a valid geometry instance.
Parameters
polygonThe input polygon.
Returns
The 3D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const Triangle &  triangle) -> double

Compute the 3D area of a Triangle.

Precondition
The input geometry triangle must be a valid geometry instance.
Parameters
triangleThe input Triangle
Returns
The 3D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const GeometryCollection &  collection) -> double

Compute the 3D area of a GeometryCollection.

Precondition
The input geometry collection must be a valid geometry instance.
Parameters
collectionThe input geometryCollection.
Returns
The 3D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const PolyhedralSurface &  surface) -> double

Compute the 3D area of a PolyhedralSurface.

Precondition
The input geometry surface must be a valid geometry instance.
Parameters
surfaceThe input PolyhedralSurface
Returns
The 3D area as a double precision value.
SFCGAL_API auto SFCGAL::algorithm::area3D ( const TriangulatedSurface &  tin) -> double

Compute the 3D area of a TriangulatedSurface.

Precondition
The input geometry tin must be a valid geometry instance.
Parameters
tinThe input TriangulatedSurface
Returns
The 3D area as a double precision value.
template<typename GeometryIterator >
std::unique_ptr<Geometry> SFCGAL::algorithm::collect ( GeometryIterator  begin,
GeometryIterator  end 
)

Returns an aggregate of a list of geometries.

Parameters
beginiterator to the beginning of the geometry list
enditerator to the end of the geometry list
Returns
an aggregate of all geometries as a unique_ptr<Geometry>
template<int Dim>
auto SFCGAL::algorithm::covers ( const detail::PrimitiveHandle< Dim > &  handle1,
const detail::PrimitiveHandle< Dim > &  handle2 
) -> bool

Cover test on PrimitiveHandle objects.

Parameters
handle1The first primitive handle
handle2The second primitive handle
Returns
true if handle1 covers handle2, false otherwise
SFCGAL_API auto SFCGAL::algorithm::distance ( const Geometry &  geometry1,
const Geometry &  geometry2 
) -> double

Compute 2D distance between two geometries.

Compute the distance between two Geometries.

Parameters
geometry1First geometry
geometry2Second geometry
Returns
Distance between the geometries
Note
When applied to NURBSCurve geometries, the distance is internally computed on a LineString obtained via toLineString() with its default parameters.
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::distance ( const Geometry &  geometry1,
const Geometry &  geometry2,
NoValidityCheck  noCheck 
) -> double

Dispatch distance between two Geometries.

Precondition
geometry1 is a valid geometry
geometry2 is a valid geometry
Parameters
geometry1First geometry
geometry2Second geometry
noCheckValidity check parameter
Returns
Distance between the geometries
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::distance3D ( const Geometry &  geometry1,
const Geometry &  geometry2,
NoValidityCheck  noCheck 
) -> double

Dispatch 3D distance between two Geometries.

Precondition
geometry1 is a valid geometry
geometry2 is a valid geometry
Parameters
geometry1First geometry
geometry2Second geometry
noCheckValidity check parameter
Returns
3D distance between the geometries
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::distance3D ( const Geometry &  geometry1,
const Geometry &  geometry2 
) -> double

Compute 3D distance between two geometries.

Dispatch 3D distance between two Geometries.

Parameters
geometry1First geometry
geometry2Second geometry
Returns
3D distance between the geometries
Note
When applied to NURBSCurve geometries, the distance is internally computed on a LineString obtained via toLineString() with its default parameters.
Todo:
complete with solid
void SFCGAL::algorithm::extractPoints ( const Geometry &  geometry,
std::vector< Point > &  points 
)

Extract all points from a geometry using GetPointsVisitor.

Parameters
geometryThe input geometry to extract points from
pointsThe output vector to store extracted points
SFCGAL_API auto SFCGAL::algorithm::extrude ( const Geometry &  inputGeom,
const Kernel::FT &  displacementX,
const Kernel::FT &  displacementY,
const Kernel::FT &  displacementZ,
NoValidityCheck &  nvc 
) -> std::unique_ptr< Geometry >

Extrude geometry without validity check.

Parameters
inputGeomInput geometry to extrude.
displacementXComponent of displacement in x-direction.
displacementYComponent of displacement in y-direction.
displacementZComponent of displacement in z-direction.
nvcA NoValidityCheck object.
Returns
Extruded geometry.
Warning
No actual validity check is conducted.
SFCGAL_API auto SFCGAL::algorithm::extrudeGableRoof ( const Polygon &  polygon,
double  clippingHeight,
double  slopeAngle = 45.0 
) -> std::unique_ptr< PolyhedralSurface >

Gable roof generation (Surface only).

Parameters
polygonThe 2D polygon footprint
clippingHeightOptional maximum height for clipping (0.0 for auto)
slopeAngleThe slope angle in degrees
Returns
A unique_ptr to the generated polyhedral surface
SFCGAL_API auto SFCGAL::algorithm::extrudeSkillionRoof ( const Polygon &  polygon,
double  clippingHeight,
size_t  primaryEdgeIndex = 0,
double  primaryAngle = 30.0,
double  secondaryAngle = 90.0 
) -> std::unique_ptr< PolyhedralSurface >

Skillion roof generation (Surface only).

Parameters
polygonThe 2D polygon footprint
clippingHeightOptional maximum height for clipping (0.0 for auto)
primaryEdgeIndexIndex of the edge where the slope starts
primaryAngleThe slope angle in degrees
secondaryAngleThe angle for other sides (usually 90.0 for skillion)
Returns
A unique_ptr to the generated polyhedral surface
auto SFCGAL::algorithm::findInsertionPosition ( const LineString &  lineString,
const Point &  point 
) -> size_t

Find the insertion position for a point on a linestring.

Parameters
lineStringThe linestring to find insertion position on
pointThe point to find insertion position for
Returns
The index where the point should be inserted
SFCGAL_API void SFCGAL::algorithm::force2D ( Geometry &  g)

force a geometry to be 2D (project on O,x,y)

Parameters
gthe geometry to force to 2D
Warning
ignore empty geometries
SFCGAL_API void SFCGAL::algorithm::force3D ( Geometry &  g,
const Kernel::FT &  defaultZ = 0 
)

force a 2D geometry to be 3D (replace undefined Z by defaultZ, existing Z values remains unchanged)

Parameters
gthe geometry to force to 3D
defaultZthe default Z value to use (default: 0)
Warning
ignore empty geometries
SFCGAL_API void SFCGAL::algorithm::forceMeasured ( Geometry &  geometry,
const double &  defaultM = 0 
)

force a 2D or M geometry to be M (replace undefined M by defaultM, existing M values remains unchanged)

Parameters
geometrythe geometry to force to measured
defaultMthe default M value to use (default: 0)
Warning
ignore empty geometries
SFCGAL_API auto SFCGAL::algorithm::generateRoof ( const Polygon &  footprint,
const RoofParameters &  params 
) -> std::unique_ptr< Geometry >

Generate a roof using unified parameters.

Parameters
footprintThe 2D polygon footprint of the building
paramsThe parameters for roof generation
Returns
A unique_ptr to the generated roof geometry
SFCGAL_API auto SFCGAL::algorithm::generateRoof ( const Polygon &  footprint,
const RoofParameters &  params,
NoValidityCheck &  nvc 
) -> std::unique_ptr< Geometry >

Generate a roof using unified parameters without validity check.

Parameters
footprintThe 2D polygon footprint of the building
paramsThe parameters for roof generation
nvcA NoValidityCheck object
Returns
A unique_ptr to the generated roof geometry
template<typename Kernel >
auto SFCGAL::algorithm::hasPlane3D ( const Polygon &  polygon,
CGAL::Point_3< Kernel > &  pointA,
CGAL::Point_3< Kernel > &  pointB,
CGAL::Point_3< Kernel > &  pointC 
) -> bool

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

Parameters
polygonThe input polygon
pointAOutput parameter for first point
pointBOutput parameter for second point
pointCOutput parameter for third point
Returns
true if a plane can be extracted, false otherwise
template<typename Kernel >
auto SFCGAL::algorithm::hasPlane3D ( const Polygon &  polygon) -> bool

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

Parameters
polygonThe input polygon
Returns
true if a plane can be extracted, false otherwise
auto SFCGAL::algorithm::insertPointIntoLineString ( const LineString &  lineString,
const Point &  point,
size_t  position 
) -> std::unique_ptr<LineString>

Insert a point into a linestring at a specific position.

Parameters
lineStringThe original linestring
pointThe point to insert
positionThe position to insert the point at
Returns
A new linestring with the point inserted
auto SFCGAL::algorithm::insertPointsIntoLineString ( const LineString &  lineString,
const std::vector< Point > &  points,
double  tolerance 
) -> std::unique_ptr<LineString>

Insert points into a linestring based on distance tolerance.

Parameters
lineStringThe original linestring to insert points into
pointsThe points to insert
toleranceThe maximum distance for a point to be considered for insertion
Returns
A new linestring with the points inserted
SFCGAL_API auto SFCGAL::algorithm::insertPointsWithinTolerance ( const Geometry &  baseGeometry,
const Geometry &  sourceGeometry,
double  tolerance = EPSILON 
) -> std::unique_ptr< Geometry >

Inserts points from sourceGeometry into baseGeometry within a given tolerance.

This function takes a base geometry and adds points from the source geometry to the base geometry where they are within the specified tolerance distance from the base geometry's segments. This is useful for topological editing operations where you want to densify a geometry with points from another.

Parameters
baseGeometryThe geometry to be modified by adding points
sourceGeometryThe geometry providing points to insert
toleranceThe maximum distance for a point to be considered for insertion
Returns
A new geometry with the points from sourceGeometry inserted into baseGeometry
template<int Dim>
auto SFCGAL::algorithm::intersection ( const detail::PrimitiveHandle< Dim > &  primitiveHandle1,
const detail::PrimitiveHandle< Dim > &  primitiveHandle2,
detail::GeometrySet< Dim > &  result 
) -> void

Intersection between two primitive handles.

Parameters
primitiveHandle1the first primitive handle
primitiveHandle2the second primitive handle
resultthe result geometry set (output parameter)
template<int Dim>
auto SFCGAL::algorithm::intersection ( const detail::GeometrySet< Dim > &  geometrySet1,
const detail::GeometrySet< Dim > &  geometrySet2,
detail::GeometrySet< Dim > &  result 
) -> void

Intersection between two geometry sets.

Parameters
geometrySet1the first geometry set
geometrySet2the second geometry set
resultthe result geometry set (output parameter)
SFCGAL_API auto SFCGAL::algorithm::isClosed ( const Geometry &  geometry) -> Closure

Check if a geometry is closed.

Parameters
geometryThe geometry to check
Returns
Closure object with status and optional reason
Note
Definition of "closed" varies by geometry type:
template<typename Kernel >
auto SFCGAL::algorithm::isPlane3D ( const Geometry &  geom,
const double &  toleranceAbs 
) -> bool

Test if all points of a geometry lie in the same plane.

Parameters
geomThe input geometry
toleranceAbsThe absolute tolerance for planarity test
Returns
true if all points lie in the same plane, false otherwise
SFCGAL_API auto SFCGAL::algorithm::length ( const LineString &  g) -> double

Compute the 2D length for a LineString.

Parameters
gThe linestring to compute length for
Returns
The 2D length of the linestring
SFCGAL_API auto SFCGAL::algorithm::length ( const GeometryCollection &  g) -> double

Compute the 2D length for a GeometryCollection.

Parameters
gThe geometry collection to compute length for
Returns
The total 2D length of all geometries in the collection
SFCGAL_API auto SFCGAL::algorithm::length ( const Geometry &  g) -> double

Compute the 2D length for a Geometry (0 for incompatible types)

Parameters
gThe geometry to compute length for
Returns
The 2D length of the geometry
Note
When applied to NURBSCurve geometries, the 2D length is internally computed on a LineString obtained via toLineString() with its default parameters.
SFCGAL_API auto SFCGAL::algorithm::length3D ( const LineString &  g) -> double

Compute the 3D length for a LineString.

Parameters
gThe linestring to compute 3D length for
Returns
The 3D length of the linestring
SFCGAL_API auto SFCGAL::algorithm::length3D ( const GeometryCollection &  g) -> double

Compute the 3D length for a GeometryCollection.

Parameters
gThe geometry collection to compute 3D length for
Returns
The total 3D length of all geometries in the collection
SFCGAL_API auto SFCGAL::algorithm::length3D ( const Geometry &  g) -> double

Compute the 3D length for a geometry.

Parameters
gThe geometry to compute 3D length for
Returns
the 3D length of the Geometry, 0 for incompatible types
SFCGAL_API auto SFCGAL::algorithm::makeConsistentOrientation3D ( TriangulatedSurface &  g) -> void

Try to make consistent orientation in a TriangulatedSurface.

Parameters
gthe triangulated surface to fix orientation for
SFCGAL_API auto SFCGAL::algorithm::makeValidOrientation ( CGAL::Polygon_2< Kernel > &  polygon) -> void

Make valid 2D orientation.

Parameters
polygonthe CGAL polygon to fix orientation for
SFCGAL_API auto SFCGAL::algorithm::makeValidOrientation ( CGAL::Polygon_with_holes_2< Kernel > &  polygon) -> void

Make valid 2D orientation.

Parameters
polygonthe CGAL polygon with holes to fix orientation for
SFCGAL_API auto SFCGAL::algorithm::makeValidOrientation ( Polygon &  polygon) -> void

Make valid 2D orientation.

Parameters
polygonthe polygon to fix orientation for
template<typename Kernel >
auto SFCGAL::algorithm::normal3D ( const CGAL::Point_3< Kernel > &  point1,
const CGAL::Point_3< Kernel > &  point2,
const CGAL::Point_3< Kernel > &  point3 
) -> CGAL::Vector_3<Kernel>

Returns the 3D normal to 3 consecutive points.

Parameters
point1the first point
point2the second point
point3the third point
Returns
the 3D normal vector
template<typename Kernel >
auto SFCGAL::algorithm::normal3D ( const LineString &  lineString,
bool  exact = true 
) -> CGAL::Vector_3<Kernel>

Returns the 3D normal to a ring (supposed to be planar and closed).

Parameters
lineStringthe line string representing the ring
exactwhether to use exact computation (default: true)
Returns
the 3D normal vector
Warning
exact allows to avoid double rounding at the end of the computation
template<typename Kernel >
auto SFCGAL::algorithm::normal3D ( const Polygon &  polygon,
bool  exact = true 
) -> CGAL::Vector_3<Kernel>

Returns the 3D normal to a polygon (supposed to be planar).

Parameters
polygonthe polygon to compute the normal for
exactwhether to use exact computation (default: true)
Returns
the 3D normal vector
Warning
exact allows to avoid double rounding at the end of the computation
SFCGAL_API std::unique_ptr<MultiPolygon> SFCGAL::algorithm::offset ( const Geometry &  geometry,
const double &  radius 
)

[experimental]compute polygon offset

Parameters
geometryThe input geometry
radiusThe offset radius
Returns
The offset polygon as a MultiPolygon
Warning
test in order to compare with minkowski sum
Precondition
geometry is a valid Geometry
Note
When applied to NURBSCurve geometries, the offset is internally computed on a LineString obtained via toLineString() with its default parameters.
SFCGAL_API std::unique_ptr<MultiPolygon> SFCGAL::algorithm::offset ( const Geometry &  geometry,
const double &  radius,
NoValidityCheck   
)

[experimental]compute polygon offset

Parameters
geometryThe input geometry
radiusThe offset radius
Returns
The offset polygon as a MultiPolygon
Warning
test in order to compare with minkowski sum
Precondition
geometry is a valid Geometry
Warning
No actual validity check is done.
SFCGAL_API auto SFCGAL::algorithm::optimalAlphaShapes ( const Geometry &  geometry,
bool  allowHoles = false,
size_t  nbComponents = 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.

Parameters
geometrythe input geometry
allowHoleswhether to allow holes in the result (default: false)
nbComponentsthe number of components (default: 1)
Returns
the computed optimal alpha shapes as a unique_ptr<Geometry>
Since
1.4.1
SFCGAL_API auto SFCGAL::algorithm::partition_2 ( const Geometry &  geometry,
PartitionAlgorithm  algorithm,
NoValidityCheck   
) -> std::unique_ptr< Geometry >

Compute the partition of a 2D polygon https://doc.cgal.org/latest/Partition_2/index.html#Chapter_2D_Polygon_Partitioning.

Parameters
geometryinput geometry
algorithmpartition algorithm to use
Returns
partitioned geometry
Precondition
geometry is a valid geometry
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::partition_2 ( const Geometry &  geometry,
PartitionAlgorithm  algorithm = y_monotone 
) -> std::unique_ptr< Geometry >

Compute the partition of a 2D polygon https://doc.cgal.org/latest/Partition_2/index.html#Chapter_2D_Polygon_Partitioning.

Parameters
geometryinput geometry
algorithmpartition algorithm to use
Returns
partitioned geometry
Since
1.4.2
template<typename Kernel >
auto SFCGAL::algorithm::plane3D ( const Polygon &  polygon,
CGAL::Point_3< Kernel > &  pointA,
CGAL::Point_3< Kernel > &  pointB,
CGAL::Point_3< Kernel > &  pointC 
) -> void

Get 3 non collinear points from a Polygon.

Parameters
polygonThe input polygon
pointAOutput parameter for first point
pointBOutput parameter for second point
pointCOutput parameter for third point
template<typename Kernel >
auto SFCGAL::algorithm::plane3D ( const Polygon &  polygon) -> CGAL::Plane_3<Kernel>

Returns the oriented 3D plane of a polygon (supposed to be planar).

May return degenerate plane.

Parameters
polygonThe input polygon
Returns
The 3D plane of the polygon
template<typename Kernel >
auto SFCGAL::algorithm::plane3D ( const Polygon &  polygon,
const Plane3DInexactUnsafe &   
) -> CGAL::Plane_3<Kernel>

Returns the oriented 3D plane of a polygon (supposed to be planar) - inexact version.

Parameters
polygonThe input polygon
Returns
The 3D plane of the polygon
Warning
Will divide by zero if polygon is degenerate.
result is rounded to double (avoid huge expression tree).
template<typename Kernel >
auto SFCGAL::algorithm::plane3D ( const Polygon &  polygon,
bool  exact 
) -> CGAL::Plane_3<Kernel>

Returns the oriented 3D plane of a polygon (supposed to be planar).

This is legacy code for SFCGAL users and should be deprecated.

Parameters
polygonThe input polygon
exactWhether to use exact computation
Returns
The 3D plane of the polygon
Warning
result is rounded to double if exact is false (avoid huge expression tree).
Will divide by zero if polygon is degenerate. This maintains the previous behaviour.
SFCGAL_API void SFCGAL::algorithm::rotate ( Geometry &  geometry,
const Kernel::FT &  angle 
)

Rotate a geometry in 2D around the origin (0,0)

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
SFCGAL_API void SFCGAL::algorithm::rotate ( Geometry &  geometry,
const Kernel::FT &  angle,
const Point &  origin 
)

Rotate a geometry in 2D around a specified point.

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
originPoint of origin for the rotation
SFCGAL_API void SFCGAL::algorithm::rotate ( Geometry &  geometry,
const Kernel::FT &  angle,
const Kernel::Vector_3 &  axis,
const Point &  origin = Point(0, 0, 0) 
)

Rotate a geometry in 3D around a specified axis and origin.

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
axisThe axis of rotation
originPoint of origin for the rotation
SFCGAL_API void SFCGAL::algorithm::rotateX ( Geometry &  geometry,
const Kernel::FT &  angle 
)

Rotate a geometry around the X axis.

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
SFCGAL_API void SFCGAL::algorithm::rotateY ( Geometry &  geometry,
const Kernel::FT &  angle 
)

Rotate a geometry around the Y axis.

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
SFCGAL_API void SFCGAL::algorithm::rotateZ ( Geometry &  geometry,
const Kernel::FT &  angle 
)

Rotate a geometry around the Z axis.

Parameters
geometryThe geometry to rotate
angleRotation angle in radians
SFCGAL_API void SFCGAL::algorithm::scale ( Geometry &  geometry,
double  scaleFactor 
)

Scale a geometry by a given factor.

Parameters
geometryinput geometry
scaleFactorscale factor
SFCGAL_API void SFCGAL::algorithm::scale ( Geometry &  geometry,
double  sx,
double  sy,
double  sz = 0.0 
)

Scale a geometry by different factors for each dimension.

Parameters
geometryinput geometry
sxscale factor for x dimension
syscale factor for y dimension
szscale factor for z dimension
SFCGAL_API void SFCGAL::algorithm::scale ( Geometry &  geometry,
double  sx,
double  sy,
double  sz,
double  cx,
double  cy,
double  cz 
)

Scale a geometry by different factors for each dimension around a center point.

Parameters
geometryinput geometry
sxscale factor for x dimension
syscale factor for y dimension
szscale factor for z dimension
cxx-coordinate of the center point
cyy-coordinate of the center point
czz-coordinate of the center point
SFCGAL_API auto SFCGAL::algorithm::signedArea ( const Triangle &  triangle) -> Kernel::FT

Computes the 2D signed area of a Triangle.

This function calculates the oriented area of a triangle in the plane. The sign of the area depends on the orientation of the triangle's vertices:

  • Positive if the points are ordered counterclockwise (CCW).
  • Negative if the points are ordered clockwise (CW).
  • Zero if the points are collinear.
Parameters
triangleThe input Triangle whose signed area is to be computed.
Returns
Kernel::FT The signed area of the Triangle.
SFCGAL_API auto SFCGAL::algorithm::signedArea ( const LineString &  lineString) -> Kernel::FT

Computes the 2D signed area of a LineString.

This function calculates the oriented area of a lineString in the plane. The sign of the area depends on the orientation of the lineString's vertices:

  • Positive if the points are ordered counterclockwise (CCW).
  • Negative if the points are ordered clockwise (CW).
  • Zero if the points are collinear.
Parameters
lineStringThe input LineString whose signed area is to be computed.
Returns
Kernel::FT The signed area of the LineString.
SFCGAL_API auto SFCGAL::algorithm::simplify ( const Geometry &  geometry,
double  threshold,
bool  preserveTopology 
) -> std::unique_ptr< Geometry >

Main entry point for geometry simplification.

Simplifies a geometry using the CGAL algorithm https://doc.cgal.org/latest/Polyline_simplification_2/index.html.

Parameters
geometryThe geometry to simplify
thresholdThe distance (in geometry unit) threshold for simplification
preserveTopologyWhether to preserve topology during simplification
Returns
A simplified copy of the input geometry
SFCGAL_API auto SFCGAL::algorithm::simplify ( const Geometry &  geometry,
double  threshold,
bool  preserveTopology,
NoValidityCheck   
) -> std::unique_ptr< Geometry >

Simplifies a geometry using the CGAL algorithm https://doc.cgal.org/latest/Polyline_simplification_2/index.html.

Parameters
geometryThe geometry to simplify
thresholdThe distance (in geometry unit) threshold for simplification
preserveTopologyWhether to preserve topology during simplification
Returns
A simplified copy of the input geometry
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::split3D ( const Geometry &  geometry,
const Point &  planePoint,
const Kernel::Vector_3 &  planeNormal,
bool  closeGeometries = false 
) -> std::unique_ptr< GeometryCollection >

Split the given geometry with a plane defined by a point and a normal vector.

Based on CGAL::PMP::split operator https://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__corefinement__grp.html

Only the TIN, PolyhedralSurface, and Solid types are currently supported.

Parameters
geometryThe input geometry to split.
planePointA point on the splitting plane.
planeNormalThe normal vector defining the plane orientation.
closeGeometriesIf true, ensures resulting geometries are closed. In the case of a SOLID, this parameter is always forced to true, since a solid is a closed geometry.
Returns
A unique pointer to a GeometryCollection of the split parts or the original geometry if the plane does not intersect it.
Since
2.3
SFCGAL_API auto SFCGAL::algorithm::straightSkeleton ( const Geometry &  geom,
bool  autoOrientation,
NoValidityCheck  ,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = EPSILON 
) -> std::unique_ptr< MultiLineString >

build a 2D straight skeleton for a Polygon

Parameters
geominput geometry
autoOrientationcheck and fix polygon orientation
innerOnlySkip non-inner edges if requested
outputDistanceInMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points. A line must have a maximum distance of toleranceAbs.
Returns
2D straight skeleton as a MultiLineString
Precondition
geom is a valid geometry
Warning
No actual validity check is done
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.
SFCGAL_API auto SFCGAL::algorithm::straightSkeleton ( const Geometry &  geom,
bool  autoOrientation = true,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = EPSILON 
) -> std::unique_ptr< MultiLineString >

build a 2D straight skeleton for a Polygon

Todo:
add supports for TriangulatedSurface and PolyhedralSurface
Parameters
geominput geometry
autoOrientationcheck and fix polygon orientation
innerOnlySkip non-inner edges if requested
outputDistanceInMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points. A line must have a maximum distance of toleranceAbs.
Returns
2D straight skeleton as a MultiLineString
Precondition
geom is a valid geometry
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.
SFCGAL_API auto SFCGAL::algorithm::straightSkeleton ( const Polygon &  geom,
bool  autoOrientation = true,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = EPSILON 
) -> std::unique_ptr< MultiLineString >

build a 2D straight skeleton for a Polygon

Parameters
geominput polygon
autoOrientationcheck and fix polygon orientation
innerOnlySkip non-inner edges if requested
outputDistanceInMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points
Returns
2D straight skeleton as a MultiLineString
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.
SFCGAL_API auto SFCGAL::algorithm::straightSkeleton ( const MultiPolygon &  geom,
bool  autoOrientation = true,
bool  innerOnly = false,
bool  outputDistanceInM = false,
const double &  toleranceAbs = EPSILON 
) -> std::unique_ptr< MultiLineString >

build a 2D straight skeleton for a Polygon

Parameters
geominput multi-polygon
autoOrientationcheck and fix polygon orientation
innerOnlySkip non-inner edges if requested
outputDistanceInMwhether to output the distance to border as M
toleranceAbsDistance tolerance between returned points
Returns
2D straight skeleton as a MultiLineString
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.
SFCGAL_API auto SFCGAL::algorithm::straightSkeletonPartition ( const Geometry &  geom,
bool  autoOrientation = true 
) -> std::unique_ptr< PolyhedralSurface >

Build a 2D straight skeleton partition for a Geometry.

Parameters
[in]geomThe input geometry
[in]autoOrientationCheck and fix polygon orientation
Returns
A unique pointer to a MultiPolygon representing the partitioned geometry
Exceptions
ExceptionIf CGAL fails to create the straight skeleton
Note
Only Triangle, Polygon, and MultiPolygon geometries are supported

This function creates a partition of the input geometry based on its straight skeleton. For unsupported geometry types, an empty MultiPolygon is returned.

SFCGAL_API auto SFCGAL::algorithm::straightSkeletonPartition ( const MultiPolygon &  geom,
bool  autoOrientation = true 
) -> std::unique_ptr< PolyhedralSurface >

Build a 2D straight skeleton partition for a MultiPolygon.

Parameters
[in]geomThe input multi-polygon
[in]autoOrientationCheck and fix polygon orientation
Returns
A unique pointer to a MultiPolygon representing the partitioned multi-polygon

This function applies the straight skeleton partition to each polygon in the input multi-polygon and combines the results into a single MultiPolygon.

SFCGAL_API auto SFCGAL::algorithm::straightSkeletonPartition ( const Polygon &  geom,
bool  autoOrientation = true 
) -> std::unique_ptr< PolyhedralSurface >

Build a 2D straight skeleton partition for a Polygon.

Parameters
[in]geomThe input polygon
[in]autoOrientationCheck and fix polygon orientation (not used in this implementation)
Returns
A unique pointer to a MultiPolygon representing the partitioned polygon
Exceptions
ExceptionIf CGAL fails to create the straight skeleton

This function creates a partition of the input polygon based on its straight skeleton. It uses CGAL's Arrangement_2 to handle the intersection of skeleton and polygon edges.

SFCGAL_API auto SFCGAL::algorithm::surfaceSimplification ( const Geometry &  geometry,
const SimplificationStopPredicate &  stopPredicate,
SimplificationStrategy  strategy 
) -> std::unique_ptr< Geometry >

Simplify a surface mesh using CGAL edge collapse algorithm.

Parameters
geometryThe input geometry to simplify (must be a surface or solid)
stopPredicateWhen to stop the simplification process
strategyThe cost and placement strategy to use
Returns
A simplified copy of the input geometry
Precondition
The input geometry must be valid and non-empty
For EDGE_COUNT_RATIO, the ratio must be in the range (0.0, 1.0)
The geometry must be 3-dimensional
Examples:
/tmp/B.oxclwyi3/BUILD/SFCGAL-2.3.0-build/SFCGAL-v2.3.0/src/algorithm/surfaceSimplification.h.
SFCGAL_API auto SFCGAL::algorithm::surfaceSimplification ( const Geometry &  geometry,
const SimplificationStopPredicate &  stopPredicate,
SimplificationStrategy  strategy,
NoValidityCheck  noCheck 
) -> std::unique_ptr< Geometry >

Simplify a surface mesh using CGAL edge collapse algorithm (no validity check)

Parameters
geometryThe input geometry to simplify
stopPredicateWhen to stop the simplification process
strategyThe cost and placement strategy to use
noCheckValidity check bypass tag
Returns
A simplified copy of the input geometry
Warning
No validity check is performed on the input geometry
See also
surfaceSimplification(const Geometry&, const SimplificationStopPredicate&, SimplificationStrategy)
SFCGAL_API auto SFCGAL::algorithm::tessellate ( const Geometry &  g,
NoValidityCheck   
) -> std::unique_ptr< Geometry >

Tessellate geometry without validity check.

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

Parameters
gGeometry to tessellate
Returns
Tessellated geometry
tessellated geometry
Precondition
g is a valid geometry
Warning
No actual validity check is done.
SFCGAL_API auto SFCGAL::algorithm::tessellate ( const Geometry &  g) -> std::unique_ptr< Geometry >

Tessellate geometry.

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

Parameters
gGeometry to tessellate
Returns
Tessellated geometry
tessellated geometry
Precondition
g is a valid geometry
SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  geometry,
const Kernel::Vector_3 &  vector 
)

translate a geometry from a given vector

Parameters
geometryThe geometry to translate
vectorThe 3D translation vector
SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  geometry,
const Kernel::Vector_2 &  vector 
)

translate a geometry from a given vector

Parameters
geometryThe geometry to translate
vectorThe 2D translation vector
SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  geometry,
const Kernel::FT &  dx,
const Kernel::FT &  dy,
const Kernel::FT &  dz 
)

translate a geometry from a given vector

Parameters
geometryThe geometry to translate
dxTranslation distance in X direction
dyTranslation distance in Y direction
dzTranslation distance in Z direction
SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  geometry,
const double &  dx,
const double &  dy,
const double &  dz 
)

translate a geometry from double-coordinates

Parameters
geometryThe geometry to translate
dxTranslation distance in X direction
dyTranslation distance in Y direction
dzTranslation distance in Z direction
template<int Dim>
void SFCGAL::algorithm::union_ ( const detail::GeometrySet< Dim > &  geometrySet1,
const detail::GeometrySet< Dim > &  geometrySet2,
detail::GeometrySet< Dim > &  result 
)

Compute union of two GeometrySet objects.

Parameters
geometrySet1First geometry set
geometrySet2Second geometry set
resultOutput geometry set containing the union
template<int Dim>
void SFCGAL::algorithm::union_ ( const detail::PrimitiveHandle< Dim > &  primitiveHandle1,
const detail::PrimitiveHandle< Dim > &  primitiveHandle2,
detail::GeometrySet< Dim > &  result 
)

Compute union of two PrimitiveHandle objects.

Parameters
primitiveHandle1First primitive handle
primitiveHandle2Second primitive handle
resultOutput geometry set containing the union
SFCGAL_API auto SFCGAL::algorithm::visibility ( const Geometry &  polygon,
const Geometry &  point 
) -> std::unique_ptr< Polygon >

build the visibility polygon of a Point inside a Polygon

Parameters
polygoninput geometry
pointinput geometry
Returns
visibility polygon
Precondition
polygon is a valid geometry
point must be inside polygon or on the boundary
SFCGAL_API auto SFCGAL::algorithm::visibility ( const Geometry &  polygon,
const Geometry &  point,
NoValidityCheck   
) -> std::unique_ptr< Polygon >

build the visibility polygon of a Point inside a Polygon

Parameters
polygoninput geometry
pointinput geometry
Returns
visibility polygon
Precondition
polygon is a valid geometry
point must be inside polygon or on the boundary
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::visibility ( const Geometry &  polygon,
const Geometry &  pointA,
const Geometry &  pointB 
) -> std::unique_ptr< Polygon >

build the visibility polygon of the segment [pointA ; pointB] on a Polygon

Parameters
polygoninput geometry
pointAinput geometry
pointBinput geometry
Returns
visibility polygon
Precondition
polygon is a valid geometry
pointA and pointB must be vertices of poly, adjacents and respect the direction
SFCGAL_API auto SFCGAL::algorithm::visibility ( const Geometry &  polygon,
const Geometry &  pointA,
const Geometry &  pointB,
NoValidityCheck   
) -> std::unique_ptr< Polygon >

build the visibility polygon of a Point inside a Polygon

Parameters
polygoninput geometry
pointAinput geometry
pointBinput geometry
Returns
visibility polygon
Precondition
polygon is a valid geometry
Warning
No actual validity check is done
Precondition
pointA and pointB must be vertices of poly, adjacents and respect the direction
SFCGAL_API auto SFCGAL::algorithm::volume ( const PolyhedralSurface &  surface,
NoValidityCheck  noValidityCheck = NoValidityCheck() 
) -> Kernel::FT

Calculate the volume of a closed PolyhedralSurface.

Parameters
surfaceThe surface whose volume to calculate
noValidityCheckTag to disable validity checking
Returns
The volume of the surface (exact arithmetic)
Exceptions
GeometryInvalidityExceptionif the surface is not closed
Warning
The surface must be closed and properly oriented
SFCGAL_API auto SFCGAL::algorithm::volume ( const Solid &  solid,
NoValidityCheck  noValidityCheck = NoValidityCheck() 
) -> Kernel::FT

Calculate the volume of a Solid.

Parameters
solidThe solid whose volume to calculate
noValidityCheckTag to disable validity checking
Returns
The volume of the solid (exact arithmetic)
Note
Outer shell contributes positively, inner shells (holes) contribute negatively
SFCGAL_API auto SFCGAL::algorithm::volume ( const Geometry &  g) -> Kernel::FT

Calculate the volume of any geometry.

Parameters
gThe geometry whose volume to calculate
Returns
The volume of the geometry (0 for 2D geometries)
Note
Returns 0 for geometries of dimension < 3
For MultiSolid and GeometryCollection, returns the sum of volumes

Variable Documentation

template<typename T >
std::function<WeightedCentroid(const T &, bool)> SFCGAL::algorithm::weightedCentroidLambda
Initial value:
=
[](const T &g, bool enable3DComputation) -> WeightedCentroid {
SFCGAL::Kernel::FT totalArea = 0.0;
SFCGAL::Kernel::FT totalM = 0.0;
Vector_3 totalWeightedCentroid;
for (typename T::const_iterator ite = g.begin(); ite != g.end(); ite++) {
WeightedCentroid wCentroid = weightedCentroid(*ite, enable3DComputation);
if (ite == g.begin()) {
totalWeightedCentroid = wCentroid.area * wCentroid.centroid;
} else {
totalWeightedCentroid += wCentroid.area * wCentroid.centroid;
}
totalM += wCentroid.area * wCentroid.m;
totalArea += wCentroid.area;
}
totalWeightedCentroid /= totalArea;
totalM /= totalArea;
return {totalArea, totalWeightedCentroid, totalM};
}
Kernel::Vector_3 Vector_3
Definition: Chamfer.cpp:38