SFCGAL  2.2.0
Classes | Enumerations | Functions
SFCGAL::algorithm Namespace Reference

Main algorithm namespace. More...

Classes

class  BoundaryVisitor
 Compute the boundary for a Geometry. More...
 
class  Buffer3D
 Computes a 3D buffer around a Point or LineString. More...
 
struct  Circle
 
class  ConsistentOrientationBuilder
 Make orientation consistent in a triangle set. More...
 
struct  found_an_intersection
 
struct  intersects_cb
 
struct  LoopDetector
 
struct  NoValidityCheck
 Tag used for variants of algorithm that do not do validity check. More...
 
struct  Plane3DInexactUnsafe
 
struct  Sphere
 
class  SurfaceGraph
 Represents a polyhedral surface as a graph where faces are nodes and egde are graph edges. More...
 
class  WeightedCentroid
 Holds weighted data to compute the centroid for a Geometry. More...
 

Typedefs

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 >
 
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  PartitionAlgorithm { y_monotone, approx_convex, greene_approx_convex, optimal_convex }
 Partition algorithm available. More...
 

Functions

auto 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 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 alphaWrapping3D (const Geometry &geom, size_t relativeAlpha, size_t relativeOffset) -> std::unique_ptr< PolyhedralSurface >
 end of private section More...
 
auto area (const Geometry &g, NoValidityCheck)
 Compute the 2D area for a Geometry. More...
 
auto area (const Geometry &g)
 Compute the 2D area for a Geometry. More...
 
auto signedArea (const Triangle &g)
 Compute the 2D signed area for a Triangle. More...
 
auto signedArea (const LineString &g)
 Compute the 2D signed area for a closed LineString. More...
 
auto area (const Triangle &g)
 Returns Compute the 2D area for a Triangle. More...
 
auto area (const Polygon &g)
 Returns Compute the 2D area for a Polygon. More...
 
auto area (const GeometryCollection &g)
 Returns the 2D area for a GeometryCollection. More...
 
auto area (const TriangulatedSurface &g)
 Returns the 2D area for a TriangulatedSurface. More...
 
auto area (const PolyhedralSurface &g)
 Returns the 2D area for a TriangulatedSurface. More...
 
auto area3D (const Geometry &g, NoValidityCheck)
 Returns 3D area for a Geometry. More...
 
auto area3D (const Geometry &g)
 Returns 3D area for a Geometry. More...
 
auto area3D (const Polygon &g)
 Returns 3D area for a Polygon. More...
 
auto area3D (const Triangle &g)
 Returns the 3D area for a Triangle. More...
 
auto area3D (const GeometryCollection &g)
 Returns the 3D area for a MultiPolygon. More...
 
auto area3D (const PolyhedralSurface &g)
 Returns the 3D area for a PolyhedralSurface. More...
 
auto area3D (const TriangulatedSurface &g)
 Returns the 3D area for a TriangulatedSurface. More...
 
auto centroid (const Geometry &g)
 Returns the 2D centroid for a Geometry. More...
 
auto centroid3D (const Geometry &g)
 Returns the 3D centroid for a Geometry. More...
 
auto weightedCentroid (const Geometry &g, bool enable3DComputation=false)
 Returns the weighted centroid for a Geometry. More...
 
auto weightedCentroid (const Triangle &g, bool enable3DComputation=false)
 Returns the weighted centroid for a Triangle. More...
 
auto weightedCentroid (const Point &a, const Point &b, const Point &c, bool enable3DComputation=false)
 Returns the weighted centroid for a Triangle. More...
 
auto weightedCentroid (const LineString &g, bool enable3DComputation=false)
 Returns the weighted centroid for a LineString. More...
 
auto weightedCentroid (const Polygon &g, bool enable3DComputation=false)
 Returns the weighted centroid for a Polygon. More...
 
auto weightedCentroid (const GeometryCollection &g, bool enable3DComputation=false)
 Returns the weighted centroid for a GeometryCollection. More...
 
auto weightedCentroid (const TriangulatedSurface &g, bool enable3DComputation=false)
 Returns the weighted centroid for a TriangulatedSurface. More...
 
auto weightedCentroid (const PolyhedralSurface &g, bool enable3DComputation=false)
 Returns the weighted centroid for a PolyhedralSurface. More...
 
auto weightedCentroid (const Solid &g, bool enable3DComputation=false)
 Returns the weighted centroid for a Solid. More...
 
auto collect (const Geometry &ga, const Geometry &gb)
 Returns an aggregate of ga and gb. More...
 
template<typename GeometryIterator >
std::unique_ptr< Geometry > collect (GeometryIterator begin, GeometryIterator end)
 Returns an aggregate of a list of geometries. More...
 
auto collectionExtractPolygons (std::unique_ptr< Geometry > coll)
 Given a geometry collection returns a MultiPolygon from triangles, polygons, polyhedral and polygons. More...
 
auto collectionHomogenize (std::unique_ptr< Geometry > coll)
 Given a geometry collection, returns the "simplest" representation of the contents. More...
 
auto collectionToMulti (std::unique_ptr< Geometry > coll)
 Given a geometry collection of triangles, TINs and polygons returns a MultiPolygon. More...
 
auto isConnected (const SurfaceGraph &graph)
 test if a surface is connected, the graph should be build beforehand More...
 
auto isClosed (const SurfaceGraph &graph)
 test if a surface is closed, the graph should be build beforehand More...
 
auto convexHull (const Geometry &g)
 Compute the 2D convex hull for a geometry. More...
 
auto convexHull3D (const Geometry &g)
 Compute the 3D convex hull for a geometry. More...
 
auto covers (const Geometry &ga, const Geometry &gb)
 Cover test on 2D geometries. More...
 
auto covers3D (const Geometry &ga, const Geometry &gb)
 Cover test on 3D geometries. More...
 
template<int Dim>
bool covers (const detail::GeometrySet< Dim > &a, const detail::GeometrySet< Dim > &b)
 
template<int Dim>
bool covers (const detail::PrimitiveHandle< Dim > &a, const detail::PrimitiveHandle< Dim > &b)
 
auto difference (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Diffrence on 2D geometries. More...
 
auto difference (const Geometry &ga, const Geometry &gb)
 Difference on 2D geometries. More...
 
auto difference3D (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Difference on 3D geometries. More...
 
auto difference3D (const Geometry &ga, const Geometry &gb)
 Difference on 3D geometries. More...
 
auto distance (const Geometry &gA, const Geometry &gB, NoValidityCheck)
 Compute the distance between two Geometries. More...
 
auto distance (const Geometry &gA, const Geometry &gB)
 Compute the distance between two Geometries. More...
 
auto distancePointGeometry (const Point &gA, const Geometry &gB)
 dispatch distance from Point to Geometry More...
 
auto distancePointPoint (const Point &gA, const Point &gB)
 distance between two Points More...
 
auto distancePointLineString (const Point &gA, const LineString &gB)
 distance between a Point and a LineString More...
 
auto distancePointPolygon (const Point &gA, const Polygon &gB)
 distance between a Point and a Polygon More...
 
auto distancePointTriangle (const Point &gA, const Triangle &gB)
 distance between a Point and a Triangle More...
 
auto distanceLineStringGeometry (const LineString &gA, const Geometry &gB)
 dispatch distance from LineString to Geometry More...
 
auto distanceLineStringLineString (const LineString &gA, const LineString &gB)
 distance between two LineStrings More...
 
auto distanceLineStringPolygon (const LineString &gA, const Polygon &gB)
 distance between a LineString and a Polygon More...
 
auto distanceLineStringTriangle (const LineString &gA, const Triangle &gB)
 distance between a LineString and a Triangle More...
 
auto distancePolygonGeometry (const Polygon &gA, const Geometry &gB)
 dispatch distance from Polygon to Geometry More...
 
auto distancePolygonPolygon (const Polygon &gA, const Polygon &gB)
 distance between two Polygons More...
 
auto distancePolygonTriangle (const Polygon &gA, const Triangle &gB)
 distance between a Polygon and a Triangle More...
 
auto distanceTriangleGeometry (const Triangle &gA, const Geometry &gB)
 dispatch distance from a Triangle to a Geometry More...
 
auto boundingCircle (const Geometry &geom) -> const Circle
 
auto distanceGeometryCollectionToGeometry (const Geometry &gA, const Geometry &gB)
 dispatch distance from a collection of geometry (gA) to a Geometry (gB) More...
 
auto distancePointSegment (const Point &p, const Point &a, const Point &b)
 
auto distanceSegmentSegment (const Point &a, const Point &b, const Point &c, const Point &d)
 
auto distance3D (const Geometry &gA, const Geometry &gB, NoValidityCheck)
 Compute distance between two 3D Geometries. More...
 
auto distance3D (const Geometry &gA, const Geometry &gB)
 dispatch distance between two Geometries More...
 
auto distancePointGeometry3D (const Point &gA, const Geometry &gB)
 dispatch distance from Point to Geometry More...
 
auto distancePointPoint3D (const Point &gA, const Point &gB)
 distance between two Points More...
 
auto distancePointLineString3D (const Point &gA, const LineString &gB)
 distance between a Point and a LineString More...
 
auto distancePointTriangle3D (const Point &gA, const Triangle &gB)
 distance between a Point and a Triangle More...
 
auto distancePointPolygon3D (const Point &gA, const Polygon &gB)
 distance between a Point and a Triangle More...
 
auto distancePointPolyhedralSurface3D (const Point &pointA, const PolyhedralSurface &polySurfaceB) -> double
 distance between a Point and a PolyhedralSurface More...
 
auto distancePointTriangulatedSurface3D (const Point &pointA, const TriangulatedSurface &triangulatedSurfaceB) -> double
 distance between a Point and a TriangulatedSurface More...
 
auto distancePointSolid3D (const Point &gA, const Solid &gB)
 distance between a Point and a Solid More...
 
auto distanceLineStringGeometry3D (const LineString &gA, const Geometry &gB)
 dispatch distance between a LineString and a Geometry More...
 
auto distanceLineStringLineString3D (const LineString &gA, const LineString &gB)
 distance between two LineStrings More...
 
auto distanceLineStringTriangle3D (const LineString &gA, const Triangle &gB)
 distance between a LineString and a Triangle More...
 
auto distanceLineStringPolygon3D (const LineString &gA, const Polygon &gB)
 distance between a LineString and a Polygon More...
 
auto distanceLineStringPolyhedralSurface3D (const LineString &lineA, const PolyhedralSurface &polySurfaceB) -> double
 distance between a LineString and a PolyhedralSurface More...
 
auto distanceLineStringTriangulatedSurface3D (const LineString &lineA, const TriangulatedSurface &triangulatedSurfaceB) -> double
 distance between a LineString and a TriangulatedSurface More...
 
auto distanceLineStringSolid3D (const LineString &gA, const Solid &gB)
 distance between a LineString and a Solid More...
 
auto distanceTriangleGeometry3D (const Triangle &gA, const Geometry &gB)
 dispatch distance between a Triangle and a Geometry More...
 
auto distanceTrianglePolyhedralSurface3D (const Triangle &triangleA, const PolyhedralSurface &polySurfaceB)
 distance between a Triangle and a PolyhedralSurface More...
 
auto distanceTriangleTriangulatedSurface3D (const Triangle &triangleA, const TriangulatedSurface &triangulatedSurfaceB) -> double
 
auto distanceTriangleSolid3D (const Triangle &gA, const Solid &gB)
 distance between a Triangle and a Solid More...
 
auto distancePolygonGeometry3D (const Polygon &gA, const Geometry &gB)
 dispatch distance between a Polygon and a Geometry More...
 
auto distancePolyhedralSurfaceGeometry3D (const PolyhedralSurface &polySurfaceA, const Geometry &geomB) -> double
 dispatch distance between a PolyhedralSurface and a Geometry More...
 
auto distanceTriangulatedSurfaceGeometry3D (const TriangulatedSurface &triangulatedSurfaceA, const Geometry &geomB) -> double
 dispatch distance between a TriangulatedSurface and a Geometry More...
 
auto distanceSolidGeometry3D (const Solid &gA, const Geometry &gB)
 dispatch distance between a Solid and a Geometry More...
 
auto distanceSolidSolid3D (const Solid &gA, const Solid &gB)
 distance between two Solids More...
 
auto boundingSphere (const Geometry &geom) -> const Sphere
 
auto distanceGeometryCollectionToGeometry3D (const Geometry &gA, const Geometry &gB)
 dispatch distance from a collection of geometry (gA) to a Geometry (gB) More...
 
auto distancePointSegment3D (const Point &p, const Point &a, const Point &b)
 
auto squaredDistancePointTriangle3D (const Point_3 &p, const Triangle_3 &abc) -> squared_distance_t
 
auto distancePointTriangle3D (const Point &p, const Point &a, const Point &b, const Point &c)
 
auto distanceSegmentSegment3D (const Point &a, const Point &b, const Point &c, const Point &d)
 
auto squaredDistanceSegmentTriangle3D (const Segment_3 &sAB, const Triangle_3 &tABC) -> squared_distance_t
 
auto distanceSegmentTriangle3D (const Point &sA, const Point &sB, const Point &tA, const Point &tB, const Point &tC)
 
auto squaredDistanceTriangleTriangle3D (const Triangle_3 &triangleA, const Triangle_3 &triangleB) -> squared_distance_t
 
auto distanceTriangleTriangle3D (const Triangle &gA, const Triangle &gB)
 distance between two Triangles More...
 
auto extrude (const Geometry &g, const Kernel::Vector_3 &v)
 Returns a Geometry equal to the specified Geometry, extruded by the specified displacement vector. More...
 
auto extrude (const Geometry &g, const Kernel::FT &dx, const Kernel::FT &dy, const Kernel::FT &dz, NoValidityCheck) -> std::unique_ptr< Geometry >
 
auto extrude (const Geometry &g, const Kernel::FT &dx, const Kernel::FT &dy, const Kernel::FT &dz)
 Returns a Geometry equal to the specified Geometry, extruded by the specified displacement. More...
 
SFCGAL_API auto extrude (const Geometry &g, const double &dx, const double &dy, const double &dz)
 Returns a Geometry equal to the specified Geometry, extruded by the specified displacement. More...
 
SFCGAL_API auto extrude (const Polygon &g, const double &height) -> std::unique_ptr< Geometry >
 
SFCGAL_API std::unique_ptr< Geometry > extrude (const Geometry &g, const Kernel::FT &dx, const Kernel::FT &dy, const Kernel::FT &dz, NoValidityCheck &nvc)
 Returns a Geometry equal to the specified Geometry, extruded by the specified displacement. 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...
 
template<int Dim>
void intersection (const detail::GeometrySet< Dim > &a, const detail::GeometrySet< Dim > &b, detail::GeometrySet< Dim > &)
 
auto intersection (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Intersection on 2D geometries. More...
 
auto intersection (const Geometry &ga, const Geometry &gb)
 Intersection on 2D geometries. More...
 
auto intersection3D (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Intersection on 3D geometries. More...
 
auto intersection3D (const Geometry &ga, const Geometry &gb)
 Intersection on 3D geometries. More...
 
template<int Dim>
auto intersects (const PrimitiveHandle< Dim > &pa, const PrimitiveHandle< Dim > &pb) -> bool
 Intersection test on a PrimitiveHandle. More...
 
template<int Dim>
auto intersects (const GeometrySet< Dim > &a, const GeometrySet< Dim > &b) -> bool
 Intersection test on GeometrySet. More...
 
auto intersects (const Geometry &ga, const Geometry &gb)
 Robust intersection test on 2D geometries. More...
 
auto intersects3D (const Geometry &ga, const Geometry &gb)
 Robust intersection test on 3D geometries. More...
 
auto intersects (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Intersection test on 2D geometries. More...
 
auto intersects3D (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Intersection test on 3D geometries. More...
 
auto selfIntersects (const LineString &l)
 Self intersection test for 2D LineString (false if only endpoint touch) More...
 
auto selfIntersects3D (const LineString &l)
 Self intersection test for 3D LineString (false if only endpoints touch) More...
 
auto selfIntersects (const PolyhedralSurface &s, const SurfaceGraph &g)
 Self intersection test for 2D PolyhedralSurface (false if only point touch) More...
 
auto selfIntersects3D (const PolyhedralSurface &s, const SurfaceGraph &g)
 Self intersection test for 3D PolyhedralSurface (false if only point touch) More...
 
auto selfIntersects (const TriangulatedSurface &s, const SurfaceGraph &g)
 Self intersection test for 2D TriangulatedSurface (false if only point touch) More...
 
auto selfIntersects3D (const TriangulatedSurface &s, const SurfaceGraph &g)
 Self intersection test for 3D TriangulatedSurface (false if only point touch) More...
 
template<int Dim>
bool intersects (const detail::GeometrySet< Dim > &a, const detail::GeometrySet< Dim > &b)
 Intersection test on GeometrySet. More...
 
template<int Dim>
bool intersects (const detail::PrimitiveHandle< Dim > &a, const detail::PrimitiveHandle< Dim > &b)
 Intersection test on a PrimitiveHandle. More...
 
auto isSimple (const Geometry &g, const double &toleranceAbs=1e-9)
 Check simplicity of a geometry. More...
 
auto isValid (const Point &p) -> const Validity
 
auto isValid (const LineString &l, const double &toleranceAbs) -> const Validity
 
auto isValid (const Polygon &p, const double &toleranceAbs) -> const Validity
 
auto isValid (const Triangle &t, const double &toleranceAbs) -> const Validity
 
auto isValid (const MultiLineString &ml, const double &toleranceAbs) -> const Validity
 
auto isValid (const MultiPolygon &mp, const double &toleranceAbs) -> const Validity
 
auto isValid (const GeometryCollection &gc, const double &toleranceAbs) -> const Validity
 
auto isValid (const TriangulatedSurface &tin, const SurfaceGraph &graph, const double &toleranceAbs) -> const Validity
 
auto isValid (const TriangulatedSurface &tin, const double &toleranceAbs) -> const Validity
 
auto isValid (const PolyhedralSurface &s, const SurfaceGraph &graph, const double &toleranceAbs) -> const Validity
 
auto isValid (const PolyhedralSurface &s, const double &toleranceAbs) -> const Validity
 
auto isValid (const Solid &solid, const double &toleranceAbs) -> const Validity
 
auto isValid (const MultiSolid &ms, const double &toleranceAbs) -> const Validity
 
auto isValid (const Geometry &g, const double &toleranceAbs=1e-9)
 Check validity of a geometry. More...
 
void propagateValidityFlag (Geometry &g, bool valid)
 Sets the geometry flag on a geometry and propagate to every internal geometries. More...
 
auto length (const LineString &g)
 Compute the 2D length for a LineString. More...
 
auto length (const GeometryCollection &g)
 Compute the 2D length for a GeometryCollection. More...
 
auto length (const Geometry &g)
 Compute the 2D length for a Geometry (0 for incompatible types) More...
 
auto length3D (const LineString &g)
 Compute the 3D length for a LineString. More...
 
auto length3D (const GeometryCollection &g)
 Compute the 3D length for a GeometryCollection. More...
 
auto length3D (const Geometry &g)
 Compute the 2D length for a geometry. More...
 
auto lineSubstring (const LineString &ls, double start, double end)
 Retrieve a substring of a specified LineString, between the specified fractional distances from the start of the specified LineString. More...
 
auto minkowskiSum (const Geometry &gA, const Polygon &gB, NoValidityCheck)
 2D minkowski sum (p+q) More...
 
auto minkowskiSum (const Geometry &gA, const Polygon &gB)
 2D minkowski sum (p+q) More...
 
auto minkowskiSum3D (const Geometry &gA, const Geometry &gB, NoValidityCheck)
 3D Minkowski sum (p+q) More...
 
auto minkowskiSum3D (const Geometry &gA, const Geometry &gB)
 3D Minkowski sum (p+q) More...
 
template<typename Kernel >
CGAL::Vector_3< Kernelnormal3D (const CGAL::Point_3< Kernel > &a, const CGAL::Point_3< Kernel > &b, const CGAL::Point_3< Kernel > &c)
 Returns the 3D normal to 3 consecutive points. More...
 
template<typename Kernel >
CGAL::Vector_3< Kernelnormal3D (const LineString &ls, bool exact=true)
 Returns the 3D normal to a ring (supposed to be planar and closed). More...
 
template<typename Kernel >
CGAL::Vector_3< Kernelnormal3D (const Polygon &polygon, bool exact=true)
 Returns the 3D normal to a polygon (supposed to be planar). More...
 
void offset (const Geometry &g, const double &radius, Offset_polygon_set_2 &polygonSet)
 dispatch a geometry More...
 
void offset (const Point &g, const double &radius, Offset_polygon_set_2 &polygonSet)
 offset for a Point More...
 
void offset (const LineString &g, const double &radius, Offset_polygon_set_2 &polygonSet)
 offset for a LineString More...
 
void offset (const Polygon &g, const double &radius, Offset_polygon_set_2 &polygonSet)
 offset for a Polygon More...
 
void offsetCollection (const Geometry &g, const double &radius, Offset_polygon_set_2 &polygonSet)
 offset for MultiPoint, MultiLineString, MultiPolygon, TriangulatedSurface, PolyhedralSurface More...
 
auto approximate (const Offset_polygon_2 &polygon, const int &n=0) -> Polygon_2
 approximate an Offset_polygon_2 (filter null segments) More...
 
auto approximate (const Offset_polygon_with_holes_2 &polygon, const int &n=0) -> Polygon_with_holes_2
 approximate an Offset More...
 
auto polygonSetToMultiPolygon (const Offset_polygon_set_2 &polygonSet, const int &n) -> std::unique_ptr< MultiPolygon >
 convert Offset_polygon_set_2 to MultiPolygon More...
 
auto circleToPolygon (const Kernel::Circle_2 &circle) -> Offset_polygon_2
 helper to create a polygon from a circle More...
 
auto offset (const Geometry &g, const double &r, NoValidityCheck)
 [experimental]compute polygon offset More...
 
auto offset (const Geometry &g, const double &r)
 [experimental]compute polygon offset More...
 
void makeValidOrientation (CGAL::Polygon_2< Kernel > &polygon)
 Make valid 2D orientation. More...
 
void makeValidOrientation (CGAL::Polygon_with_holes_2< Kernel > &polygon)
 Make valid 2D orientation. More...
 
void makeValidOrientation (Polygon &polygon)
 Make valid 2D orientation. More...
 
auto hasConsistentOrientation3D (const TriangulatedSurface &g)
 Test if a Geometry has a consistent orientation. More...
 
auto hasConsistentOrientation3D (const PolyhedralSurface &g)
 Test if a PolyhedralSurface has a consistent orientation. More...
 
void makeConsistentOrientation3D (TriangulatedSurface &g)
 Try to make consistent orientation in a TriangulatedSurface. More...
 
auto isCounterClockWiseOriented (const LineString &)
 Test if a 2D surface is oriented counter clockwise. More...
 
auto isCounterClockWiseOriented (const Triangle &)
 Test if a 2D surface is oriented counter clockwise. More...
 
auto isCounterClockWiseOriented (const Polygon &)
 Test if a 2D surface is oriented counter clockwise. More...
 
auto partition_2 (const Geometry &g, PartitionAlgorithm alg, 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 &g, PartitionAlgorithm alg=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 >
bool 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...
 
template<typename Kernel >
bool hasPlane3D (const Polygon &polygon)
 Test if a 3D plane can be extracted from a Polygon. More...
 
template<typename Kernel >
void plane3D (const Polygon &polygon, CGAL::Point_3< Kernel > &a, CGAL::Point_3< Kernel > &b, CGAL::Point_3< Kernel > &c)
 Get 3 non collinear points from a Polygon. More...
 
template<typename Kernel >
CGAL::Plane_3< Kernelplane3D (const Polygon &polygon)
 Returns the oriented 3D plane of a polygon (supposed to be planar). More...
 
template<typename Kernel >
CGAL::Plane_3< Kernelplane3D (const Polygon &polygon, const Plane3DInexactUnsafe &)
 Returns the oriented 3D plane of a polygon (supposed to be planar) - inexact version. More...
 
template<typename Kernel >
CGAL::Plane_3< Kernelplane3D (const Polygon &polygon, bool exact)
 Returns the oriented 3D plane of a polygon (supposed to be planar). More...
 
template<typename Kernel >
bool isPlane3D (const Geometry &geom, const double &toleranceAbs)
 Test if all points of a geometry lie in the same plane. More...
 
void rotate (Geometry &g, const Kernel::FT &angle)
 Rotate a geometry in 2D around the origin (0,0) More...
 
void rotate (Geometry &g, const Kernel::FT &angle, const Point &origin)
 Rotate a geometry in 2D around a specified point. More...
 
void rotate (Geometry &g, 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 &g, const Kernel::FT &angle)
 Rotate a geometry around the X axis. More...
 
void rotateY (Geometry &g, const Kernel::FT &angle)
 Rotate a geometry around the Y axis. More...
 
void rotateZ (Geometry &g, const Kernel::FT &angle)
 Rotate a geometry around the Z axis. More...
 
void scale (Geometry &g, double s)
 Scale a geometry by a given factor. More...
 
void scale (Geometry &g, double sx, double sy, double sz=0.0)
 Scale a geometry by different factors for each dimension. More...
 
void scale (Geometry &g, 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...
 
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) -> std::unique_ptr< MultiLineString >
 build an approximate medial axis for a Polygon More...
 
auto extrudeStraightSkeleton (const Polygon &geom, double height) -> std::unique_ptr< PolyhedralSurface >
 
auto extrudeStraightSkeleton (const Geometry &geom, double height) -> std::unique_ptr< PolyhedralSurface >
 
auto extrudeStraightSkeleton (const Geometry &geom, double building_height, double roof_height) -> std::unique_ptr< PolyhedralSurface >
 
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...
 
SFCGAL_API auto extrudedStraightSkeleton (const Polygon &geom, double height) -> std::unique_ptr< PolyhedralSurface >
 build a 3D straight skeleton extruded for a Polygon More...
 
auto tesselate (const Geometry &, NoValidityCheck)
 Tesselate a geometry: this will triangulate surfaces (including polyhedral and solid's surfaces) and keep untouched points, lines, etc. More...
 
auto tesselate (const Geometry &)
 Tesselate a geometry: this will triangulate surfaces (including polyhedral and solid's surfaces) and keep untouched points, lines, etc. More...
 
void translate (Geometry &g, const Kernel::Vector_3 &v)
 translate a geometry from a given vector More...
 
void translate (Geometry &g, const Kernel::Vector_2 &v)
 translate a geometry from a given vector More...
 
void translate (Geometry &g, const Kernel::FT &dx, const Kernel::FT &dy, const Kernel::FT &dz)
 translate a geometry from a given vector More...
 
void translate (Geometry &g, const double &dx, const double &dy, const double &dz)
 translate a geometry from double-coordinates More...
 
auto union3D (const Geometry &ga, const Geometry &gb, NoValidityCheck)
 Union on 3D geometries. More...
 
auto union3D (const Geometry &ga, const Geometry &gb)
 Union on 3D geometries. More...
 
template<int Dim>
void union_ (const detail::GeometrySet< Dim > &a, const detail::GeometrySet< Dim > &b, detail::GeometrySet< Dim > &)
 
template<int Dim>
void union_ (const detail::PrimitiveHandle< Dim > &a, const detail::PrimitiveHandle< Dim > &b, detail::GeometrySet< Dim > &)
 
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 Solid &g, NoValidityCheck)
 Computes the volume of a Solid. More...
 
auto volume (const Geometry &g)
 Computes the volume of a geometry. More...
 

Variables

template<typename T >
std::function< WeightedCentroid(const T &, bool)> weightedCentroidLambda
 
using Vb = CGAL::Alpha_shape_vertex_base_2< Kernel >
 
using Fb = CGAL::Alpha_shape_face_base_2< Kernel >
 
using Tds = CGAL::Triangulation_data_structure_2< Vb, Fb >
 
using Triangulation_2 = CGAL::Delaunay_triangulation_2< Kernel, Tds >
 
using Alpha_shape_2 = CGAL::Alpha_shape_2< Triangulation_2 >
 
using Alpha_shape_edges_iterator = Alpha_shape_2::Alpha_shape_edges_iterator
 
using Traits_2 = CGAL::Arr_non_caching_segment_basic_traits_2< Kernel >
 
using Arrangement = CGAL::Arrangement_2< Traits_2 >
 
typedef detail::NoVolume NoVolume
 
typedef detail::MarkedPolyhedron MarkedPolyhedron
 
typedef CGAL::Box_intersection_d::Box_with_handle_d< double, 3, MarkedPolyhedron::Halfedge_around_facet_const_circulator > FaceBboxBase
 
auto intersection (const CGAL::Triangle_3< Kernel > &a, const CGAL::Triangle_3< Kernel > &b) -> CGAL::Object
 
using Polyline_3 = std::vector< Kernel::Point_3 >
 
using Nef_polyhedron_3 = CGAL::Nef_polyhedron_3< Kernel >
 
using Traits = CGAL::Partition_traits_2< Kernel >
 
using TPoint_2 = Traits::Point_2
 
using TPolygon_2 = Traits::Polygon_2
 
using Face_handle = Arrangement_2::Face_handle
 
using Face_const_handle = Arrangement_2::Face_const_handle
 
using Halfedge_const_handle = Arrangement_2::Halfedge_const_handle
 
using TEV = CGAL::Triangular_expansion_visibility_2< Arrangement_2, CGAL::Tag_true >
 

Detailed Description

Main algorithm namespace.

Typedef Documentation

using SFCGAL::algorithm::Alpha_shape_2 = typedef CGAL::Alpha_shape_2<Triangulation_2>
using SFCGAL::algorithm::Alpha_shape_edges_iterator = typedef Alpha_shape_2::Alpha_shape_edges_iterator
using SFCGAL::algorithm::Arrangement = typedef CGAL::Arrangement_2<Traits_2>
typedef CGAL::Arrangement_2< Traits_2 > SFCGAL::algorithm::Arrangement_2
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::Face_const_handle = typedef Arrangement_2::Face_const_handle
using SFCGAL::algorithm::Face_handle = typedef Arrangement_2::Face_handle
typedef CGAL::Box_intersection_d::Box_with_handle_d< double, 3, MarkedPolyhedron::Halfedge_around_facet_const_circulator> SFCGAL::algorithm::FaceBboxBase
using SFCGAL::algorithm::Fb = typedef CGAL::Alpha_shape_face_base_2<Kernel>
using SFCGAL::algorithm::Halfedge_const_handle = typedef Arrangement_2::Halfedge_const_handle
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::Nef_polyhedron_3 = typedef CGAL::Nef_polyhedron_3<Kernel>
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::Tds = typedef CGAL::Triangulation_data_structure_2<Vb, Fb>
using SFCGAL::algorithm::TEV = typedef CGAL::Triangular_expansion_visibility_2<Arrangement_2, CGAL::Tag_true>
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>
typedef CGAL::Arr_segment_traits_2< Kernel > SFCGAL::algorithm::Traits_2
using SFCGAL::algorithm::Triangulation_2 = typedef CGAL::Delaunay_triangulation_2<Kernel, Tds>
using SFCGAL::algorithm::Vb = typedef CGAL::Alpha_shape_vertex_base_2<Kernel>

Enumeration Type Documentation

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

Function Documentation

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
SFCGAL_API std::unique_ptr< PolyhedralSurface > SFCGAL::algorithm::alphaWrapping3D ( const Geometry &  geom,
size_t  relativeAlpha,
size_t  relativeOffset = 0 
)

end of private section

Computes the 3D alpha wrapping of a geometry https://doc.cgal.org/latest/Alpha_wrap_3/index.html.

Since
2.1
Parameters
geominput geometry
relativeAlphaThis parameter is used to determine which features will appear in the output A small relativeAlpha will produce an output less complex but less faithful to the input
relativeOffsetThis parameter controls the tightness of the result A large relativeOffset parameter will tend to better preserve sharp features as projection If this parameter is equal to 0, it is computed from the alpha parameter
Returns
A PolyhedralSurface representing the 3D alpha wrapping of the geometry
auto SFCGAL::algorithm::approximate ( const Offset_polygon_2 &  polygon,
const int &  n = 0 
) -> Polygon_2

approximate an Offset_polygon_2 (filter null segments)

auto SFCGAL::algorithm::approximate ( const Offset_polygon_with_holes_2 &  polygon,
const int &  n = 0 
) -> Polygon_with_holes_2

approximate an Offset

SFCGAL_API auto SFCGAL::algorithm::approximateMedialAxis ( const Geometry &  geom) -> std::unique_ptr< MultiLineString >

build an approximate medial axis for a Polygon

Parameters
geominput geometry
Precondition
geom is a valid geometry
Exceptions
NotImplementedExceptionIf geom is a Polygon with point touching rings.
SFCGAL_API double SFCGAL::algorithm::area ( const Geometry &  g,
NoValidityCheck   
)

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
Warning
No actual validity check is done
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
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
auto SFCGAL::algorithm::boundingCircle ( const Geometry &  geom) -> const Circle
auto SFCGAL::algorithm::boundingSphere ( const Geometry &  geom) -> const Sphere
SFCGAL_API std::unique_ptr< Point > SFCGAL::algorithm::centroid ( const Geometry &  g)

Returns the 2D centroid for a Geometry.

The result is the weighted centroid of a geometry. The implementation follows PostGIS one (https://postgis.net/docs/ST_Centroid.html). The weigth is computed in the XY space.

Warning
Z component is ignored, geometries must be valid when projected in the XY plane. Vertical geometries will generate an error.
Precondition
g is a valid geometry in 2D
SFCGAL_API std::unique_ptr< Point > SFCGAL::algorithm::centroid3D ( const Geometry &  g)

Returns the 3D centroid for a Geometry.

The result is the weighted centroid of a geometry. The implementation follows PostGIS one (https://postgis.net/docs/ST_Centroid.html). The weigth is computed in the 3D space.

Precondition
g is a valid geometry
auto SFCGAL::algorithm::circleToPolygon ( const Kernel::Circle_2 &  circle) -> Offset_polygon_2

helper to create a polygon from a circle

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::collect ( const Geometry &  ga,
const Geometry &  gb 
) -> std::unique_ptr< Geometry >

Returns an aggregate of ga and gb.

SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::collectionExtractPolygons ( std::unique_ptr< Geometry >  coll)

Given a geometry collection returns a MultiPolygon from triangles, polygons, polyhedral and polygons.

Warning
Ownership is taken from the parameter
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::collectionHomogenize ( std::unique_ptr< Geometry >  coll)

Given a geometry collection, returns the "simplest" representation of the contents.

Singletons will be returned as singletons. Collections that are homogeneous will be returned as the appropriate multi-type.

Warning
Ownership is taken from the parameter
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::collectionToMulti ( std::unique_ptr< Geometry >  coll)

Given a geometry collection of triangles, TINs and polygons returns a MultiPolygon.

Warning
Ownership is taken from the parameter
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::convexHull ( const Geometry &  g) -> std::unique_ptr< Geometry >

Compute the 2D convex hull for a geometry.

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
SFCGAL_API bool SFCGAL::algorithm::covers ( const Geometry &  ga,
const Geometry &  gb 
)

Cover test on 2D geometries.

Checks if gA covers gB. Force projection to z=0 if needed

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

Cover test on 3D geometries.

Checks if gA covers gB. Assume z = 0 if needed

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

Diffrence on 2D geometries.

No validity check variant

Precondition
ga and gb are valid geometries
Warning
No actual validity check is done.
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
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::difference3D ( const Geometry &  ga,
const Geometry &  gb,
NoValidityCheck   
)

Difference on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries
Warning
@ No actual validity check is done
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
SFCGAL_API double SFCGAL::algorithm::distance ( const Geometry &  gA,
const Geometry &  gB,
NoValidityCheck   
)

Compute the distance between two Geometries.

Precondition
gA is a valid geometry
gB is a valid geometry
Warning
No actual validity check is done
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
SFCGAL_API double SFCGAL::algorithm::distance3D ( const Geometry &  gA,
const Geometry &  gB,
NoValidityCheck   
)

Compute distance between two 3D Geometries.

Precondition
gA is a valid geometry
gB is a valid geometry
Warning
No actual validity check is done
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
auto SFCGAL::algorithm::distanceTriangleTriangulatedSurface3D ( const Triangle triangleA,
const TriangulatedSurface triangulatedSurfaceB 
) -> double
SFCGAL_API std::unique_ptr<Geometry> SFCGAL::algorithm::extrude ( const Geometry &  g,
const Kernel::FT &  dx,
const Kernel::FT &  dy,
const Kernel::FT &  dz,
NoValidityCheck nvc 
)

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.
nvcA NoValidityCheck object.
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.
Warning
No actual validity check is conducted.
auto SFCGAL::algorithm::extrude ( const Geometry &  g,
const Kernel::FT &  dx,
const Kernel::FT &  dy,
const Kernel::FT &  dz,
NoValidityCheck   
) -> std::unique_ptr<Geometry>
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::extrude ( const Geometry &  g,
const Kernel::FT &  dx,
const Kernel::FT &  dy,
const 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.
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::extrude ( const Polygon g,
const double &  height 
) -> std::unique_ptr< Geometry >
auto SFCGAL::algorithm::extrudeStraightSkeleton ( const Polygon geom,
double  height 
) -> std::unique_ptr<PolyhedralSurface>
SFCGAL_API auto SFCGAL::algorithm::extrudeStraightSkeleton ( const Geometry &  geom,
double  height 
) -> std::unique_ptr< PolyhedralSurface >
SFCGAL_API auto SFCGAL::algorithm::extrudeStraightSkeleton ( const Geometry &  geom,
double  building_height,
double  roof_height 
) -> std::unique_ptr< PolyhedralSurface >
SFCGAL_API void SFCGAL::algorithm::force2D ( Geometry &  g)

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

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)

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)

Warning
ignore empty geometries
SFCGAL_API bool SFCGAL::algorithm::hasConsistentOrientation3D ( const TriangulatedSurface g) -> bool

Test if a Geometry has a consistent orientation.

SFCGAL_API bool SFCGAL::algorithm::hasConsistentOrientation3D ( const PolyhedralSurface g) -> bool

Test if a PolyhedralSurface has a consistent orientation.

template<typename Kernel >
bool SFCGAL::algorithm::hasPlane3D ( const Polygon polygon)

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

CGAL::Object SFCGAL::algorithm::intersection ( const CGAL::Triangle_3< Kernel > &  a,
const CGAL::Triangle_3< Kernel > &  b 
) -> CGAL::Object
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::intersection ( const Geometry &  ga,
const Geometry &  gb,
NoValidityCheck   
)

Intersection on 2D geometries.

No validity check variant

Precondition
ga and gb are valid geometries
Warning
No actual validity check is done.
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
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::intersection3D ( const Geometry &  ga,
const Geometry &  gb,
NoValidityCheck   
)

Intersection on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries
Warning
@ No actual validity check is done
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
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
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
SFCGAL_API bool SFCGAL::algorithm::isCounterClockWiseOriented ( const LineString ls) -> bool

Test if a 2D surface is oriented counter clockwise.

SFCGAL_API bool SFCGAL::algorithm::isCounterClockWiseOriented ( const Triangle tri) -> bool

Test if a 2D surface is oriented counter clockwise.

SFCGAL_API bool SFCGAL::algorithm::isCounterClockWiseOriented ( const Polygon poly) -> bool

Test if a 2D surface is oriented counter clockwise.

SFCGAL_API const Simplicity SFCGAL::algorithm::isSimple ( const Geometry &  g,
const double &  toleranceAbs 
) -> const Simplicity

Check simplicity of a geometry.

auto SFCGAL::algorithm::isValid ( const Point p) -> const Validity
Note
empty geometries are valid, but the test is only performed in the interface function in individual functions for implementation, an assertion !empty is present for this reason
auto SFCGAL::algorithm::isValid ( const LineString l,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const Polygon p,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const Triangle t,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const MultiLineString ml,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const MultiPolygon mp,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const GeometryCollection gc,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const TriangulatedSurface tin,
const SurfaceGraph graph,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const TriangulatedSurface tin,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const PolyhedralSurface s,
const SurfaceGraph graph,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const PolyhedralSurface s,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const Solid solid,
const double &  toleranceAbs 
) -> const Validity
auto SFCGAL::algorithm::isValid ( const MultiSolid ms,
const double &  toleranceAbs 
) -> const Validity
SFCGAL_API const Validity SFCGAL::algorithm::isValid ( const Geometry &  g,
const double &  toleranceAbs 
) -> const Validity

Check validity of a geometry.

SFCGAL_API double SFCGAL::algorithm::length ( const LineString g) -> double

Compute the 2D length for a LineString.

SFCGAL_API double SFCGAL::algorithm::length ( const GeometryCollection g) -> double

Compute the 2D length for a GeometryCollection.

SFCGAL_API double SFCGAL::algorithm::length ( const Geometry &  g) -> double

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

SFCGAL_API double SFCGAL::algorithm::length3D ( const LineString g) -> double

Compute the 3D length for a LineString.

SFCGAL_API double SFCGAL::algorithm::length3D ( const GeometryCollection g) -> double

Compute the 3D length for a GeometryCollection.

SFCGAL_API double SFCGAL::algorithm::length3D ( const Geometry &  g)

Compute the 2D length for a geometry.

Returns
the length of the Geometry, 0 for incompatible types
SFCGAL_API std::unique_ptr< LineString > SFCGAL::algorithm::lineSubstring ( const LineString ls,
double  start,
double  end 
)

Retrieve a substring of a specified LineString, between the specified fractional distances from the start of the specified LineString.

Parameters
lsThe specified LineString.
startThe fraction along the specified LineString defining the start of the desired substring.
endThe fraction along the specified LineString defining the end of the desired substring.
Note
Negative values of
start
and/or
end
will be interpreted as a fractional distance taken from the end of the specified LineString. +/-0 will always be interpreted as the start of
ls
.
For open lines, a negative length range will result in a line substring terminating at the specified points, but with an orientation reversed relative to
ls
. For closed lines the a negative range corresponds to the complentary section of
ls
with an orientation equal to that of it.
Returns
The specified line substring.
Exceptions
Ifeither
start
or
end
have an absolute value greater than 1.
SFCGAL_API void SFCGAL::algorithm::makeConsistentOrientation3D ( TriangulatedSurface g)

Try to make consistent orientation in a TriangulatedSurface.

SFCGAL_API void SFCGAL::algorithm::makeValidOrientation ( CGAL::Polygon_2< Kernel > &  polygon)

Make valid 2D orientation.

SFCGAL_API void SFCGAL::algorithm::makeValidOrientation ( CGAL::Polygon_with_holes_2< Kernel > &  polygon)

Make valid 2D orientation.

SFCGAL_API void SFCGAL::algorithm::makeValidOrientation ( Polygon polygon)

Make valid 2D orientation.

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

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
Warning
@ No actual validity check is done.
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
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::minkowskiSum3D ( const Geometry &  gA,
const Geometry &  gB,
NoValidityCheck   
)

3D Minkowski sum (p+q)

Precondition
gA and gB are valid 3D geometries
Warning
No actual validity check is done.
SFCGAL_API std::unique_ptr< Geometry > SFCGAL::algorithm::minkowskiSum3D ( const Geometry &  gA,
const Geometry &  gB 
)

3D Minkowski sum (p+q)

Precondition
gA and gB are valid 3D geometries
template<typename Kernel >
CGAL::Vector_3<Kernel> SFCGAL::algorithm::normal3D ( const CGAL::Point_3< Kernel > &  a,
const CGAL::Point_3< Kernel > &  b,
const CGAL::Point_3< Kernel > &  c 
)

Returns the 3D normal to 3 consecutive points.

template<typename Kernel >
CGAL::Vector_3<Kernel> SFCGAL::algorithm::normal3D ( const LineString ls,
bool  exact = true 
)

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

Warning
exact allows to avoid double rounding at the end of the computation
template<typename Kernel >
CGAL::Vector_3<Kernel> SFCGAL::algorithm::normal3D ( const Polygon polygon,
bool  exact = true 
)

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

Warning
exact allows to avoid double rounding at the end of the computation
void SFCGAL::algorithm::offset ( const Geometry &  g,
const double &  radius,
Offset_polygon_set_2 &  polygonSet 
)

dispatch a geometry

void SFCGAL::algorithm::offset ( const Point g,
const double &  radius,
Offset_polygon_set_2 &  polygonSet 
)

offset for a Point

build Point offset

void SFCGAL::algorithm::offset ( const LineString g,
const double &  radius,
Offset_polygon_set_2 &  polygonSet 
)

offset for a LineString

build LineString offset

void SFCGAL::algorithm::offset ( const Polygon g,
const double &  radius,
Offset_polygon_set_2 &  polygonSet 
)

offset for a Polygon

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

[experimental]compute polygon offset

Warning
test in order to compare with minkowski sum
Precondition
g is a valid Geometry
Warning
No actual validity check is done.
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
void SFCGAL::algorithm::offsetCollection ( const Geometry &  g,
const double &  radius,
Offset_polygon_set_2 &  polygonSet 
)
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
SFCGAL_API auto SFCGAL::algorithm::partition_2 ( const Geometry &  g,
PartitionAlgorithm  alg,
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.

Precondition
g is a valid geometry
Warning
No actual validity check is done
SFCGAL_API auto SFCGAL::algorithm::partition_2 ( const Geometry &  g,
PartitionAlgorithm  alg = y_monotone 
) -> std::unique_ptr< Geometry >
template<typename Kernel >
void SFCGAL::algorithm::plane3D ( const Polygon polygon,
CGAL::Point_3< Kernel > &  a,
CGAL::Point_3< Kernel > &  b,
CGAL::Point_3< Kernel > &  c 
)

Get 3 non collinear points from a Polygon.

template<typename Kernel >
CGAL::Plane_3<Kernel> SFCGAL::algorithm::plane3D ( const Polygon polygon,
bool  exact 
)

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

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

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.
auto SFCGAL::algorithm::polygonSetToMultiPolygon ( const Offset_polygon_set_2 &  polygonSet,
const int &  n 
) -> std::unique_ptr<MultiPolygon>

convert Offset_polygon_set_2 to MultiPolygon

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

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

SFCGAL_API void SFCGAL::algorithm::rotate ( Geometry &  g,
const Kernel::FT &  angle 
)

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

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

Rotate a geometry in 2D around a specified point.

Parameters
gThe geometry to rotate
angleRotation angle in radians
originPoint of origin for the rotation
SFCGAL_API void SFCGAL::algorithm::rotate ( Geometry &  g,
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
gThe geometry to rotate
angleRotation angle in radians
axisThe axis of rotation
originPoint of origin for the rotation
SFCGAL_API void SFCGAL::algorithm::rotateX ( Geometry &  g,
const Kernel::FT &  angle 
)

Rotate a geometry around the X axis.

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

Rotate a geometry around the Y axis.

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

Rotate a geometry around the Z axis.

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

Scale a geometry by a given factor.

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

Scale a geometry by different factors for each dimension.

Parameters
ginput geometry
sxscale factor for x dimension
syscale factor for y dimension
szscale factor for z dimension
SFCGAL_API void SFCGAL::algorithm::scale ( Geometry &  g,
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
ginput 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::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
auto SFCGAL::algorithm::squaredDistancePointTriangle3D ( const Point_3 p,
const Triangle_3 abc 
) -> squared_distance_t
auto SFCGAL::algorithm::squaredDistanceSegmentTriangle3D ( const Segment_3 sAB,
const Triangle_3 tABC 
) -> squared_distance_t
auto SFCGAL::algorithm::squaredDistanceTriangleTriangle3D ( const Triangle_3 triangleA,
const Triangle_3 triangleB 
) -> squared_distance_t
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.
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.
Precondition
geom is a valid geometry
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 std::unique_ptr< SFCGAL::Geometry > SFCGAL::algorithm::tesselate ( const Geometry &  ,
NoValidityCheck   
)

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
Warning
No actual validity check is done.
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
SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  g,
const Kernel::Vector_3 &  v 
)

translate a geometry from a given vector

SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  g,
const Kernel::Vector_2 &  v 
)

translate a geometry from a given vector

SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  g,
const Kernel::FT &  dx,
const Kernel::FT &  dy,
const Kernel::FT &  dz 
)

translate a geometry from a given vector

SFCGAL_API void SFCGAL::algorithm::translate ( Geometry &  g,
const double &  dx,
const double &  dy,
const double &  dz 
)

translate a geometry from double-coordinates

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

Union on 3D geometries.

Assume z = 0 if needed

Precondition
ga and gb are valid geometries
Warning
@ No actual validity check is done
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
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
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
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
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
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 const Kernel::FT SFCGAL::algorithm::volume ( const Solid g,
NoValidityCheck   
)

Computes the volume of a Solid.

Precondition
(not checked) volume is closed and consistently oriented
SFCGAL_API const Kernel::FT SFCGAL::algorithm::volume ( const Geometry &  g)

Computes the volume of a geometry.

Precondition
g is a valid Geometry

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 wc = weightedCentroid(*ite, enable3DComputation);
if (ite == g.begin())
totalWeightedCentroid = wc.area * wc.centroid;
else
totalWeightedCentroid += wc.area * wc.centroid;
totalM += wc.area * wc.m;
totalArea += wc.area;
}
totalWeightedCentroid /= totalArea;
totalM /= totalArea;
return {totalArea, totalWeightedCentroid, totalM};
}
auto weightedCentroid(const Solid &g, bool enable3DComputation) -> WeightedCentroid
Returns the weighted centroid for a Solid.
Definition: centroid.cpp:316
CGAL::Vector_3< SFCGAL::Kernel > Vector_3
Definition: Kernel.h:43