SFCGAL  2.3.0
Typedefs | Enumerations | Functions
Public C API

Typedefs

typedef uint32_t srid_t
 SRID type. More...
 
typedef void sfcgal_geometry_t
 sfcgal_geometry_t is an opaque pointer type that is used to represent a pointer to SFCGAL::Geometry More...
 
typedef void sfcgal_prepared_geometry_t
 Opaque type that represents the C++ type SFCGAL::PreparedGeometry. More...
 
typedef void sfcgal_primitive_t
 sfcgal_primitive_t is an opaque pointer type that is used to represent a pointer to SFCGAL::Primitive More...
 
typedef int(* sfcgal_error_handler_t) (const char *,...)
 Warning and error handlers. More...
 

Enumerations

enum  sfcgal_geometry_type_t {
  SFCGAL_TYPE_POINT = 1, SFCGAL_TYPE_LINESTRING = 2, SFCGAL_TYPE_POLYGON = 3, SFCGAL_TYPE_MULTIPOINT = 4,
  SFCGAL_TYPE_MULTILINESTRING = 5, SFCGAL_TYPE_MULTIPOLYGON = 6, SFCGAL_TYPE_GEOMETRYCOLLECTION = 7, SFCGAL_TYPE_POLYHEDRALSURFACE = 15,
  SFCGAL_TYPE_TRIANGULATEDSURFACE = 16, SFCGAL_TYPE_TRIANGLE = 17, SFCGAL_TYPE_NURBSCURVE = 21, SFCGAL_TYPE_SOLID = 25,
  SFCGAL_TYPE_MULTISOLID = 26
}
 Geometric types. More...
 
enum  sfcgal_roof_type_t { SFCGAL_ROOF_FLAT = 0, SFCGAL_ROOF_HIPPED = 1, SFCGAL_ROOF_SKILLION = 2, SFCGAL_ROOF_GABLE = 3 }
 Roof type for sfcgal_geometry_generate_roof. More...
 
enum  sfcgal_buffer3d_type_t { SFCGAL_BUFFER3D_ROUND, SFCGAL_BUFFER3D_CYLSPHERE, SFCGAL_BUFFER3D_FLAT }
 Buffer3D types. More...
 
enum  sfcgal_simplification_strategy_t { SFCGAL_SIMPLIFICATION_STRATEGY_EDGE_LENGTH = 0, SFCGAL_SIMPLIFICATION_STRATEGY_GARLAND_HECKBERT = 1, SFCGAL_SIMPLIFICATION_STRATEGY_LINDSTROM_TURK = 2 }
 Simplification strategy for edge collapsing algorithms. More...
 
enum  sfcgal_primitive_type_t {
  SFCGAL_TYPE_INVALID = -1, SFCGAL_TYPE_BOX = 0, SFCGAL_TYPE_CONE, SFCGAL_TYPE_CUBE,
  SFCGAL_TYPE_CYLINDER, SFCGAL_TYPE_SPHERE, SFCGAL_TYPE_TORUS
}
 Primitive types. More...
 
enum  sfcgal_knot_method_t { SFCGAL_KNOT_METHOD_UNIFORM = 0, SFCGAL_KNOT_METHOD_CHORD_LENGTH = 1, SFCGAL_KNOT_METHOD_CENTRIPETAL = 2 }
 Knot vector generation methods for NURBS curves. More...
 
enum  sfcgal_end_condition_t { SFCGAL_END_CONDITION_CLAMPED = 0, SFCGAL_END_CONDITION_NATURAL = 1, SFCGAL_END_CONDITION_PERIODIC = 2, SFCGAL_END_CONDITION_TANGENT = 3 }
 End conditions for curve fitting and interpolation. More...
 
enum  sfcgal_fit_method_t { SFCGAL_FIT_METHOD_INTERPOLATE = 0, SFCGAL_FIT_METHOD_APPROXIMATE = 1 }
 Curve fitting methods. More...
 

Functions

SFCGAL_API void sfcgal_set_geometry_validation (int enabled)
 Set the geometry validation mode. More...
 
SFCGAL_API sfcgal_geometry_type_t sfcgal_geometry_type_id (const sfcgal_geometry_t *geom)
 Returns the type of a given geometry. More...
 
SFCGAL_API void sfcgal_geometry_type (const sfcgal_geometry_t *geom, char **type, size_t *type_len)
 Returns the type of a given geometry as a string. More...
 
SFCGAL_API int sfcgal_geometry_dimension (const sfcgal_geometry_t *geom)
 Returns the dimension of a given geometry ( 0 : punctual, 1 : curve, ...) More...
 
SFCGAL_API int sfcgal_geometry_is_valid (const sfcgal_geometry_t *geom)
 Tests if the given geometry is valid or not. More...
 
SFCGAL_API int sfcgal_geometry_is_valid_detail (const sfcgal_geometry_t *geom, char **invalidity_reason, sfcgal_geometry_t **invalidity_location)
 Tests if the given geometry is valid or not And return details in case of invalidity. More...
 
SFCGAL_API int sfcgal_geometry_is_complexity_detail (const sfcgal_geometry_t *geom, char **invalidity_reason, sfcgal_geometry_t **invalidity_location)
 
SFCGAL_API int sfcgal_geometry_is_simple (const sfcgal_geometry_t *geom)
 Tests if the given geometry is simple or not. More...
 
SFCGAL_API int sfcgal_geometry_is_simple_detail (const sfcgal_geometry_t *geom, char **complexity_reason)
 Tests if the given geometry is simple or not And return details in case of complexity. More...
 
SFCGAL_API int sfcgal_geometry_is_3d (const sfcgal_geometry_t *geom)
 Tests if the given geometry is 3D or not. More...
 
SFCGAL_API int sfcgal_geometry_is_measured (const sfcgal_geometry_t *geom)
 Tests if the given geometry is measured (has an m) or not. More...
 
SFCGAL_API int sfcgal_geometry_is_empty (const sfcgal_geometry_t *geom)
 Tests if the given geometry is empty or not. More...
 
SFCGAL_API int sfcgal_geometry_is_closed (const sfcgal_geometry_t *geom)
 Tests if the given geometry is closed or not. More...
 
SFCGAL_API int sfcgal_geometry_drop_z (sfcgal_geometry_t *geom)
 Drops the z coordinate of the geometry. More...
 
SFCGAL_API int sfcgal_geometry_drop_m (sfcgal_geometry_t *geom)
 Drops the m coordinate of the geometry. More...
 
SFCGAL_API int sfcgal_geometry_force_z (sfcgal_geometry_t *geom, double default_z)
 Adds a z-dimension to the geometry, initialized to a preset value. More...
 
SFCGAL_API int sfcgal_geometry_force_m (sfcgal_geometry_t *geom, double default_m)
 Adds a m-dimension to the geometry, initialized to a preset value. More...
 
SFCGAL_API void sfcgal_geometry_swap_xy (sfcgal_geometry_t *geom)
 Swaps the x and y coordinates of the geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_clone (const sfcgal_geometry_t *geom)
 Returns a deep clone of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_delete (sfcgal_geometry_t *geom)
 Deletes a given geometry. More...
 
SFCGAL_API size_t sfcgal_geometry_num_geometries (const sfcgal_geometry_t *collection)
 Returns the number of geometries of the given geometry collection. More...
 
SFCGAL_API void sfcgal_geometry_as_text (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Returns a WKT representation of the given geometry using CGAL exact integer fractions as coordinate values. More...
 
SFCGAL_API void sfcgal_geometry_as_text_decim (const sfcgal_geometry_t *geom, int num_decimals, char **buffer, size_t *len)
 Returns a WKT representation of the given geometry using floating point coordinate values. More...
 
SFCGAL_API void sfcgal_geometry_as_wkb (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Returns a WKB representation of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_as_hexwkb (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Returns a WKB representation as hexadecimal of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_as_vtk (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Creates a VTK string of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_as_vtk_file (const sfcgal_geometry_t *geom, const char *filename)
 Creates a VTK file of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_as_obj_file (const sfcgal_geometry_t *geom, const char *filename)
 Creates a OBJ file of the given geometry The generated OBJ file uses the Z-up convention. More...
 
SFCGAL_API void sfcgal_geometry_as_obj (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Creates a OBJ string of the given geometry The generated OBJ string uses the Z-up convention. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_obj (const char *str, size_t len)
 Reads a geometry from an OBJ format string. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_obj_file (const char *filename)
 Reads a geometry from an OBJ file. More...
 
SFCGAL_API void sfcgal_geometry_as_stl (const sfcgal_geometry_t *geom, char **buffer, size_t *len)
 Creates a STL string of the given geometry The generated STL string uses the Z-up convention. More...
 
SFCGAL_API void sfcgal_geometry_as_stl_file (const sfcgal_geometry_t *geom, const char *filename)
 Creates a STL file of the given geometry The generated STL file uses the Z-up convention. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create (void)
 Creates an empty point. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create_from_xy (double x, double y)
 Creates a point from two X and Y coordinates. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create_from_xyz (double x, double y, double z)
 Creates a point from three X, Y and Z coordinates. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create_from_xym (double x, double y, double m)
 Creates a point from three X, Y and M coordinates. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create_from_xyzm (double x, double y, double z, double m)
 Creates a point from four X, Y, Z and M coordinates. More...
 
SFCGAL_API double sfcgal_point_x (const sfcgal_geometry_t *geom)
 Returns the X coordinate of the given SFCGAL::Point. More...
 
SFCGAL_API double sfcgal_point_y (const sfcgal_geometry_t *geom)
 Returns the Y coordinate of the given SFCGAL::Point. More...
 
SFCGAL_API double sfcgal_point_z (const sfcgal_geometry_t *geom)
 Returns the Z coordinate of the given SFCGAL::Point. More...
 
SFCGAL_API double sfcgal_point_m (const sfcgal_geometry_t *geom)
 Returns the M coordinate of the given SFCGAL::Point. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_linestring_create (void)
 Creates an empty SFCGAL::LineString. More...
 
SFCGAL_API size_t sfcgal_linestring_num_points (const sfcgal_geometry_t *linestring)
 Returns the number of points of the given SFCGAL::LineString. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_linestring_point_n (const sfcgal_geometry_t *linestring, size_t index)
 Returns the ith point of a given SFCGAL::LineString. More...
 
SFCGAL_API void sfcgal_linestring_add_point (sfcgal_geometry_t *linestring, sfcgal_geometry_t *point)
 Adds a point to a SFCGAL::LineString. More...
 
SFCGAL_API void sfcgal_linestring_closes (sfcgal_geometry_t *linestring)
 Closes the SCGAL::LineString if it is not already closed. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_triangle_create (void)
 Creates an empty SFCGAL::Triangle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_triangle_create_from_points (const sfcgal_geometry_t *pta, const sfcgal_geometry_t *ptb, const sfcgal_geometry_t *ptc)
 Creates a SFCGAL::Triangle from three given SFCGAL::Point. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_triangle_vertex (const sfcgal_geometry_t *triangle, int index)
 Returns one the SFCGAL::Triangle's vertex as a SFCGAL::Point. More...
 
SFCGAL_API void sfcgal_triangle_set_vertex (sfcgal_geometry_t *triangle, int index, const sfcgal_geometry_t *vertex)
 Sets one vertex of a SFCGAL::Triangle. More...
 
SFCGAL_API void sfcgal_triangle_set_vertex_from_xy (sfcgal_geometry_t *triangle, int index, double x, double y)
 Sets one vertex of a SFCGAL::Triangle from two coordinates. More...
 
SFCGAL_API void sfcgal_triangle_set_vertex_from_xyz (sfcgal_geometry_t *triangle, int index, double x, double y, double z)
 Sets one vertex of a SFCGAL::Triangle from three coordinates. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_polygon_create (void)
 Creates an empty SFCGAL::Polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_polygon_create_from_exterior_ring (sfcgal_geometry_t *ring)
 Creates an empty SFCGAL::Polygon from an exterior ring. More...
 
SFCGAL_API void sfcgal_polygon_set_exterior_ring (sfcgal_geometry_t *polygon, sfcgal_geometry_t *ring)
 Sets the exterior ring of a given SFCGAL::Polygon. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_polygon_exterior_ring (const sfcgal_geometry_t *polygon)
 Returns the exterior ring of a given SFCGAL::Polygon. More...
 
SFCGAL_API size_t sfcgal_polygon_num_interior_rings (const sfcgal_geometry_t *polygon)
 Returns the number of interior rings of a given SFCGAL::Polygon. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_polygon_interior_ring_n (const sfcgal_geometry_t *polygon, size_t index)
 Returns the ith interior ring of a given SFCGAL::Polygon. More...
 
SFCGAL_API void sfcgal_polygon_add_interior_ring (sfcgal_geometry_t *polygon, sfcgal_geometry_t *ring)
 Adds an interior ring to a given SFCGAL::Polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_collection_create (void)
 Creates an empty SFCGAL::GeometryCollection. More...
 
SFCGAL_API size_t sfcgal_geometry_collection_num_geometries (const sfcgal_geometry_t *collection)
 Returns the number of geometries of a given SFCGAL::GeometryCollection. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_geometry_collection_geometry_n (const sfcgal_geometry_t *collection, size_t index)
 Returns the ith geometry of a SFCGAL::GeometryCollection. More...
 
SFCGAL_API void sfcgal_geometry_collection_set_geometry_n (sfcgal_geometry_t *collection, sfcgal_geometry_t *geometry, size_t index)
 Set the ith geometry of a given SFCGAL::GeometryCollection. More...
 
SFCGAL_API void sfcgal_geometry_collection_add_geometry (sfcgal_geometry_t *collection, sfcgal_geometry_t *geometry)
 Adds a Geometry to a given SFCGAL::GeometryCollection. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_point_create (void)
 Creates an empty SFCGAL::MultiPoint. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_linestring_create (void)
 Creates an empty SFCGAL::MultiLineString. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_polygon_create (void)
 Creates an empty SFCGAL::MultiPolygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_solid_create (void)
 Creates an empty SFCGAL::MultiSolid. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_polyhedral_surface_create (void)
 Creates an empty SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API size_t sfcgal_polyhedral_surface_num_patches (const sfcgal_geometry_t *polyhedral)
 Returns the number of patches of a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API size_t sfcgal_polyhedral_surface_num_polygons (const sfcgal_geometry_t *polyhedral)
 Returns the number of polygons of a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API size_t sfcgal_polyhedral_surface_num_edges (const sfcgal_geometry_t *polyhedral)
 Get the number of edges into a PolyhedralSurface. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_polyhedral_surface_patch_n (const sfcgal_geometry_t *polyhedral, size_t index)
 Returns the ith patch of a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_polyhedral_surface_polygon_n (const sfcgal_geometry_t *polyhedral, size_t index)
 Returns the ith polygon of a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API void sfcgal_polyhedral_surface_add_patch (sfcgal_geometry_t *polyhedral, sfcgal_geometry_t *patch)
 Adds a patch to a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API void sfcgal_polyhedral_surface_set_patch_n (sfcgal_geometry_t *polyhedral, sfcgal_geometry_t *patch, size_t index)
 Set the ith patch of a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API void sfcgal_polyhedral_surface_add_polygon (sfcgal_geometry_t *polyhedral, sfcgal_geometry_t *polygon)
 Adds a SFCGAL::Polygon to a given SFCGAL::PolyhedralSurface. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_triangulated_surface_create (void)
 Creates an empty SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API size_t sfcgal_triangulated_surface_num_patches (const sfcgal_geometry_t *tin)
 Returns the number of patches of a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API size_t sfcgal_triangulated_surface_num_triangles (const sfcgal_geometry_t *tin)
 Returns the number of triangles of a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API size_t sfcgal_triangulated_surface_num_edges (const sfcgal_geometry_t *tin)
 Get the number of edges into a TriangulatedSurface. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_triangulated_surface_patch_n (const sfcgal_geometry_t *tin, size_t index)
 Returns the ith patch of a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_triangulated_surface_triangle_n (const sfcgal_geometry_t *tin, size_t index)
 Returns the ith SFCGAL::Triangle of a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API void sfcgal_triangulated_surface_set_patch_n (sfcgal_geometry_t *tin, sfcgal_geometry_t *patch, size_t index)
 Set the ith patch of a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API void sfcgal_triangulated_surface_add_patch (sfcgal_geometry_t *tin, sfcgal_geometry_t *patch)
 Adds a patch to a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API void sfcgal_triangulated_surface_add_triangle (sfcgal_geometry_t *tin, sfcgal_geometry_t *triangle)
 Adds a SFCGAL::Triangle to a given SFCGAL::TriangulatedSurface. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_solid_create (void)
 Creates an empty SFCGAL::Solid. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_solid_create_from_exterior_shell (sfcgal_geometry_t *shell)
 Creates a SFCGAL::Solid from an exterior shell. More...
 
SFCGAL_API size_t sfcgal_solid_num_shells (const sfcgal_geometry_t *solid)
 Returns the number of shells of a given SFCGAL::Solid. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_solid_shell_n (const sfcgal_geometry_t *solid, size_t index)
 Returns the ith shell of a given SFCGAL::Solid. More...
 
SFCGAL_API void sfcgal_solid_add_interior_shell (sfcgal_geometry_t *solid, sfcgal_geometry_t *shell)
 Adds a shell to a given SFCGAL::Solid. More...
 
SFCGAL_API void sfcgal_solid_set_exterior_shell (sfcgal_geometry_t *solid, sfcgal_geometry_t *shell)
 Set the exterior shell of a given SFCGAL::Solid. More...
 
SFCGAL_API int sfcgal_geometry_has_validity_flag (const sfcgal_geometry_t *geom)
 Gets the validity flag of the geometry. More...
 
SFCGAL_API void sfcgal_geometry_force_valid (sfcgal_geometry_t *geom, int valid)
 Sets the validity flag of the geometry. More...
 
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_prepared_geometry_create (void)
 Creates an empty SFCGAL::PreparedGeometry. More...
 
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_prepared_geometry_create_from_geometry (sfcgal_geometry_t *geometry, srid_t srid)
 Creates a SFCGAL::PreparedGeometry from a Geometry and an SRID. More...
 
SFCGAL_API void sfcgal_prepared_geometry_delete (sfcgal_prepared_geometry_t *prepared)
 Deletes a given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_prepared_geometry_geometry (const sfcgal_prepared_geometry_t *prepared)
 Returns the SFCGAL::Geometry associated with a given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API void sfcgal_prepared_geometry_set_geometry (sfcgal_prepared_geometry_t *prepared, sfcgal_geometry_t *geometry)
 Sets the Geometry associated with the given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API srid_t sfcgal_prepared_geometry_srid (const sfcgal_prepared_geometry_t *prepared)
 Returns SRID associated with a given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API void sfcgal_prepared_geometry_set_srid (sfcgal_prepared_geometry_t *prepared, srid_t srid)
 Sets SRID associated with a given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API void sfcgal_prepared_geometry_as_ewkt (const sfcgal_prepared_geometry_t *prepared, int num_decimals, char **buffer, size_t *len)
 Returns an EWKT representation of the given SFCGAL::PreparedGeometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_wkt (const char *str, size_t len)
 io::readWKT More...
 
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_io_read_ewkt (const char *str, size_t len)
 Parse an Extended Well-Known Text (EWKT) representation into a PreparedGeometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_geojson (const char *str, size_t len)
 Parse a GeoJSON representation into a Geometry. More...
 
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_io_read_geojson_prepared (const char *str, size_t len)
 Parse a GeoJSON representation into a PreparedGeometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_wkb (const char *str, size_t len)
 io::readWKB More...
 
SFCGAL_API void sfcgal_io_write_binary_prepared (const sfcgal_prepared_geometry_t *geom, char **buffer, size_t *len)
 Serialization. More...
 
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_io_read_binary_prepared (const char *str, size_t len)
 Read a SFCGAL::PreparedGeometry from a binary representation. More...
 
SFCGAL_API void sfcgal_geometry_as_geojson (const sfcgal_geometry_t *geom, bool strict, int precision, bool include_bbox, char **buffer, size_t *len)
 Convert a Geometry to its GeoJSON representation. More...
 
SFCGAL_API void sfcgal_prepared_geometry_as_geojson (const sfcgal_prepared_geometry_t *prepared, bool strict, int precision, bool include_bbox, char **buffer, size_t *len)
 Convert a PreparedGeometry to its GeoJSON representation. More...
 
SFCGAL_API int sfcgal_geometry_intersects (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Tests the intersection of geom1 and geom2. More...
 
SFCGAL_API int sfcgal_geometry_intersects_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Tests the 3D intersection of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_intersection (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the intersection of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_intersection_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the 3D intersection of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_difference (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the difference of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_difference_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the 3D difference of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_union (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the union of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_union_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the 3D union of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_convexhull (const sfcgal_geometry_t *geom)
 Returns the convex hull of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_convexhull_3d (const sfcgal_geometry_t *geom)
 Returns the 3D convex hull of geom. More...
 
SFCGAL_API double sfcgal_geometry_volume (const sfcgal_geometry_t *geom)
 Returns the volume of geom (must be a volume) More...
 
SFCGAL_API double sfcgal_geometry_area (const sfcgal_geometry_t *geom)
 Returns the area of geom. More...
 
SFCGAL_API double sfcgal_geometry_area_3d (const sfcgal_geometry_t *geom)
 Returns the 3D area of geom. More...
 
SFCGAL_API int sfcgal_geometry_is_planar (const sfcgal_geometry_t *geom)
 Tests if the given Geometry is planar. More...
 
SFCGAL_API int sfcgal_geometry_orientation (const sfcgal_geometry_t *geom)
 Returns the orientation of the given SFCGAL::Polygon -1 for a counter clockwise orientation 1 for a clockwise orientation 0 for an invalid or undetermined orientation. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_tesselate (const sfcgal_geometry_t *geom)
 Returns a tessellation of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_tessellate (const sfcgal_geometry_t *geom)
 Returns a tessellation of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_triangulate_2dz (const sfcgal_geometry_t *geom)
 Returns a triangulation of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude (const sfcgal_geometry_t *geom, double ex, double ey, double ez)
 Returns an extrusion of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_make_solid (const sfcgal_geometry_t *geom)
 Convert a SFCGAL::PolyhedralSurface to a SFCGAL::Solid. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_force_lhr (const sfcgal_geometry_t *geom)
 Force a Left Handed Rule on the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_force_rhr (const sfcgal_geometry_t *geom)
 Force a Right Handed Rule on the given Geometry. More...
 
SFCGAL_API double sfcgal_geometry_distance (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Computes the distance of the two given Geometry objects. More...
 
SFCGAL_API double sfcgal_geometry_distance_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Computes the 3D distance of the two given Geometry objects. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_round (const sfcgal_geometry_t *geom, int scale)
 Round coordinates of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_minkowski_sum (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the 2D minkowski sum geom1 + geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_insert_points_within_tolerance (const sfcgal_geometry_t *base, const sfcgal_geometry_t *source, double tolerance)
 Insert points from source geometry into base geometry within tolerance. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_minkowski_sum_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the 3D minkowski sum geom1 + geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_offset_polygon (const sfcgal_geometry_t *geom, double radius)
 Returns the offset polygon of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_straight_skeleton (const sfcgal_geometry_t *geom)
 Returns the straight skeleton of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_straight_skeleton_distance_in_m (const sfcgal_geometry_t *geom)
 Returns the straight skeleton of the given Geometry with the distance to the border as M coordinate. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_straight_skeleton (const sfcgal_geometry_t *geom, double height)
 Returns the extrude straight skeleton of the given SFCGAL::Polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_polygon_straight_skeleton (const sfcgal_geometry_t *geom, double building_height, double roof_height)
 Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_straight_skeleton_with_angles (const sfcgal_geometry_t *geom, double height, const double *angles, const size_t *angles_per_ring, size_t num_rings)
 Returns the extrude straight skeleton for the given SFCGAL::Geometry with custom per-edge angles. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_polygon_straight_skeleton_with_angles (const sfcgal_geometry_t *geom, double building_height, double roof_height, const double *angles, const size_t *angles_per_ring, size_t num_rings)
 Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon, with custom per-edge angles. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_straight_skeleton_with_weights (const sfcgal_geometry_t *geom, double height, const double *weights, const size_t *weights_per_ring, size_t num_rings)
 Returns the extrude straight skeleton of the given SFCGAL::Polygon, with custom per-edge weights. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_extrude_polygon_straight_skeleton_with_weights (const sfcgal_geometry_t *geom, double building_height, double roof_height, const double *weights, const size_t *weights_per_ring, size_t num_rings)
 Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon, with custom per-edge weights. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_generate_roof (const sfcgal_geometry_t *geom, sfcgal_roof_type_t roof_type, double slope_angle, double height, size_t primary_edge_index)
 Generate a roof from a polygon using a specified type. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_generate_flat_roof (const sfcgal_geometry_t *geom, double height)
 Generate a flat roof from a polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_generate_hipped_roof (const sfcgal_geometry_t *geom, double height)
 Generate a hipped roof from a polygon using straight skeleton. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_generate_gable_roof (const sfcgal_geometry_t *geom, double height, double slope_angle)
 Generate a gable roof from a polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_generate_skillion_roof (const sfcgal_geometry_t *geom, double height, double slope_angle, size_t primary_edge_index)
 Generate a skillion (mono-pitch) roof from a polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_approximate_medial_axis (const sfcgal_geometry_t *geom)
 Returns the approximate medial axis for the given SFCGAL::Polygon Approximate medial axis is based on straight skeleton. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_projected_medial_axis (const sfcgal_geometry_t *geom)
 Returns the projected medial axis for the given SFCGAL::Polygon Projected medial axis is based on approximate medial axis and extend end lines to polygon edges. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_straight_skeleton_partition (const sfcgal_geometry_t *geom, bool auto_orientation)
 Returns the straight skeleton partition for the given SFCGAL::Polygon. More...
 
SFCGAL_API int sfcgal_geometry_covers (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Tests the 2D coverage of geom1 and geom2. More...
 
SFCGAL_API int sfcgal_geometry_covers_3d (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Tests the 3D coverage of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_line_sub_string (const sfcgal_geometry_t *geom, double start, double end)
 Returns the substring of the given SFCGAL::LineString between fractional distances. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_alpha_shapes (const sfcgal_geometry_t *geom, double alpha, bool allow_holes)
 Returns the alpha shapes of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_optimal_alpha_shapes (const sfcgal_geometry_t *geom, bool allow_holes, size_t nb_components)
 Returns the optimal alpha shapes of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_alpha_wrapping_3d (const sfcgal_geometry_t *geom, size_t relative_alpha, size_t relative_offset)
 Returns the 3D alpha wrapping of a geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_envelope (const sfcgal_geometry_t *geom)
 Returns the envelope of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_envelope_3d (const sfcgal_geometry_t *geom)
 Returns the 3d envelope of geom. More...
 
SFCGAL_API double sfcgal_geometry_length (const sfcgal_geometry_t *geom)
 Returns the 2D length of geom. More...
 
SFCGAL_API double sfcgal_geometry_length_3d (const sfcgal_geometry_t *geom)
 Returns the 3D length of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_boundary (const sfcgal_geometry_t *geom)
 Returns the boundary of geom. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_centroid (const sfcgal_geometry_t *geom)
 Returns a SFCGAL::Point representing the geometry centroid. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_centroid_3d (const sfcgal_geometry_t *geom)
 Returns a SFCGAL::Point representing the geometry centroid. More...
 
SFCGAL_API int sfcgal_geometry_is_equals (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns true if geom1 is equals to geom2. More...
 
SFCGAL_API int sfcgal_geometry_is_almost_equals (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2, double tolerance)
 Returns true if geom1 is almost equals to geom2. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_y_monotone_partition_2 (const sfcgal_geometry_t *geom)
 Returns the y monotone partition of a geometry (polygon without hole) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_approx_convex_partition_2 (const sfcgal_geometry_t *geom)
 Returns the approximal convex partition of a geometry (polygon without hole) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_greene_approx_convex_partition_2 (const sfcgal_geometry_t *geom)
 Returns the greene approximal convex partition of a geometry (polygon without hole) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_optimal_convex_partition_2 (const sfcgal_geometry_t *geom)
 Returns the optimal convex partition of a geometry (polygon without hole) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_visibility_point (const sfcgal_geometry_t *polygon, const sfcgal_geometry_t *point)
 Returns the visibility polygon of a SFCGAL::Point inside a SFCGAL::Polygon. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_visibility_segment (const sfcgal_geometry_t *polygon, const sfcgal_geometry_t *point_a, const sfcgal_geometry_t *point_b)
 build the visibility polygon of the segment [point_a ; point_b] on a SFCGAL::Polygon More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_buffer3d (const sfcgal_geometry_t *geom, double radius, int segments, sfcgal_buffer3d_type_t buffer_type)
 Computes a 3D buffer around a geometry. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_2d (const sfcgal_geometry_t *geom, double angle, double cx, double cy)
 Rotates a geometry in 2D around a specified point by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate (const sfcgal_geometry_t *geom, double angle)
 Rotates a geometry in 2D around the origin (0,0) by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_3d_around_center (const sfcgal_geometry_t *geom, double angle, double ax, double ay, double az, double cx, double cy, double cz)
 Rotates a geometry in 3D around a specified axis and center point by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_3d (const sfcgal_geometry_t *geom, double angle, double ax, double ay, double az)
 Rotates a geometry in 3D around a specified axis and origin (0, 0, 0) by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_x (const sfcgal_geometry_t *geom, double angle)
 Rotates a geometry in 3D around the X axis and origin (0, 0, 0) by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_y (const sfcgal_geometry_t *geom, double angle)
 Rotates a geometry around the Y axis and origin (0, 0, 0) by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_z (const sfcgal_geometry_t *geom, double angle)
 Rotates a geometry around the Z axis and origin (0, 0, 0) by a given angle. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_scale (const sfcgal_geometry_t *geom, double scale)
 Scale a geometry by a given factor. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_scale_3d (const sfcgal_geometry_t *geom, double sx, double sy, double sz)
 Scale a geometry by different factors for each dimension. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_scale_3d_around_center (const sfcgal_geometry_t *geom, 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...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_translate_3d (const sfcgal_geometry_t *geom, double dx, double dy, double dz)
 Translate a geometry by a 3D vector. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_translate_2d (const sfcgal_geometry_t *geom, double dx, double dy)
 Translate a geometry by a 2D vector. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_transform (const sfcgal_geometry_t *geom, const double *matrix4x4)
 Transform a geometry by a 3D matrix (4x4) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_simplify (const sfcgal_geometry_t *geom, double threshold, bool preserve_topology)
 Simplify a geometry by simplifying the polylines it contains. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_simplify_surface_edge_count (const sfcgal_geometry_t *geometry, size_t edge_count, sfcgal_simplification_strategy_t strategy)
 Simplify a surface mesh using CGAL edge collapse algorithm. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_simplify_surface_edge_ratio (const sfcgal_geometry_t *geometry, double edge_ratio, sfcgal_simplification_strategy_t strategy)
 Simplify a surface mesh using CGAL edge collapse algorithm. More...
 
SFCGAL_API sfcgal_primitive_type_t sfcgal_primitive_type_id (const sfcgal_primitive_t *primitive)
 Returns the type of a given primtive. More...
 
SFCGAL_API sfcgal_primitive_t * sfcgal_primitive_create (sfcgal_primitive_type_t primitive_type)
 Creates a new primitive of the specified type with default parameters. More...
 
SFCGAL_API void sfcgal_primitive_delete (sfcgal_primitive_t *primitive)
 Deletes a previously allocated primitive. More...
 
SFCGAL_API sfcgal_primitive_t * sfcgal_primitive_clone (const sfcgal_primitive_t *primitive)
 Returns a deep clone of the given primitive. More...
 
SFCGAL_API int sfcgal_primitive_is_almost_equals (const sfcgal_primitive_t *prim1, const sfcgal_primitive_t *prim2, double tolerance)
 Returns true if prim1 is equals to prim2. More...
 
SFCGAL_API double sfcgal_primitive_area (const sfcgal_primitive_t *prim, bool with_discretization)
 Computes primitive area. More...
 
SFCGAL_API double sfcgal_primitive_volume (const sfcgal_primitive_t *prim, bool with_discretization)
 Computes primitive volume. More...
 
SFCGAL_API void sfcgal_primitive_parameters (const sfcgal_primitive_t *primitive, char **buffer, size_t *len)
 Retrieves the list of primitive parameters as JSON array of { name, type, value }. More...
 
SFCGAL_API void sfcgal_primitive_parameter (const sfcgal_primitive_t *primitive, const char *name, char **buffer, size_t *len)
 Retrieves the primitive parameter name as JSON object { name, type, value }. More...
 
SFCGAL_API void sfcgal_primitive_set_parameter (sfcgal_primitive_t *primitive, const char *name, const char *json_value)
 Sets the value of a primitive parameter name as JSON object { name, type, value }. More...
 
SFCGAL_API double sfcgal_primitive_parameter_double (const sfcgal_primitive_t *primitive, const char *name)
 Retrieves the value of a primitive parameter as a double. More...
 
SFCGAL_API void sfcgal_primitive_set_parameter_double (sfcgal_primitive_t *primitive, const char *name, double parameter)
 Sets the value of a primitive parameter as a double. More...
 
SFCGAL_API unsigned int sfcgal_primitive_parameter_int (const sfcgal_primitive_t *primitive, const char *name)
 Retrieves the value of a primitive parameter as an unsigned int. More...
 
SFCGAL_API void sfcgal_primitive_set_parameter_int (sfcgal_primitive_t *primitive, const char *name, unsigned int parameter)
 Sets the value of a primitive parameter as an unsigned int. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_primitive_as_polyhedral_surface (const sfcgal_primitive_t *primitive)
 Generates a polyhedral surface representation of the primitive. More...
 
SFCGAL_API double * sfcgal_primitive_transformation (const sfcgal_primitive_t *primitive)
 Retrieves the primitive's current transformation matrix as an array. More...
 
SFCGAL_API sfcgal_primitive_t * sfcgal_primitive_translate (const sfcgal_primitive_t *primitive, double dx, double dy, double dz)
 Translates a primitive by a 3D vector. More...
 
SFCGAL_API sfcgal_primitive_t * sfcgal_primitive_rotate (const sfcgal_primitive_t *primitive, double angle, double ax, double ay, double az, double cx, double cy, double cz)
 Rotates a primitive around a specified axis and center point by a given angle. More...
 
SFCGAL_API sfcgal_primitive_t * sfcgal_primitive_scale (const sfcgal_primitive_t *primitive, double sx, double sy, double sz, double cx, double cy, double cz)
 Scales a primitive by the given factor. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_split_3d (const sfcgal_geometry_t *geom, double ptx, double pty, double ptz, double normalx, double normaly, double normalz, bool close_geometries)
 Splits the given geometry with a plane defined by a point and a normal vector. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_chamfer (const sfcgal_geometry_t *solid, const sfcgal_geometry_t *edge, double radius, double radius_y, double epsilon)
 Replace sharp edges of a solid with a flat bevelled face (chamfer). More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_fillet (const sfcgal_geometry_t *solid, const sfcgal_geometry_t *edge, double radius, int segments, double epsilon)
 Replace sharp edges of a solid with a smooth circular-arc fillet. More...
 
SFCGAL_API void sfcgal_set_error_handlers (sfcgal_error_handler_t warning_handler, sfcgal_error_handler_t error_handler)
 Sets the error handlers. More...
 
SFCGAL_API void sfcgal_set_alloc_handlers (sfcgal_alloc_handler_t alloc_handler, sfcgal_free_handler_t free_handler)
 Sets the allocation handlers. More...
 
SFCGAL_API void sfcgal_free_buffer (void *buffer)
 Delete a buffer previously allocated and returned by SFCGAL. More...
 
SFCGAL_API void sfcgal_init (void)
 This function must be called before all the other one. More...
 
SFCGAL_API const char * sfcgal_version (void)
 Get version. More...
 
SFCGAL_API const char * sfcgal_full_version (void)
 Get full version (including CGAL and Boost versions) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create (void)
 Creates an empty NURBS curve. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_from_points (const sfcgal_geometry_t **points, size_t num_points, unsigned int degree, sfcgal_knot_method_t knot_method)
 Creates a NURBS curve from control points with uniform weights. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_from_points_and_weights (const sfcgal_geometry_t **points, const double *weights, size_t num_points, unsigned int degree, sfcgal_knot_method_t knot_method)
 Creates a NURBS curve from control points and weights. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_from_full_data (const sfcgal_geometry_t **points, const double *weights, size_t num_points, unsigned int degree, const double *knots, size_t num_knots)
 Creates a NURBS curve with full control over parameters. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_bezier (const sfcgal_geometry_t **points, size_t num_points)
 Creates a NURBS curve from Bezier control points. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_bspline (const sfcgal_geometry_t **points, size_t num_points, unsigned int degree)
 Creates a uniform B-spline curve. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_create_circular_arc (const sfcgal_geometry_t *center, double radius, double start_angle, double end_angle, const sfcgal_geometry_t *normal)
 Creates a circular arc as NURBS curve. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_interpolate (const sfcgal_geometry_t **points, size_t num_points, unsigned int degree, sfcgal_knot_method_t knot_method, sfcgal_end_condition_t end_condition)
 Creates an interpolating NURBS curve through points. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_approximate (const sfcgal_geometry_t **points, size_t num_points, unsigned int degree, double tolerance, size_t max_control_points)
 Creates an approximating NURBS curve. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_fit (const sfcgal_geometry_t **points, size_t num_points, unsigned int degree, sfcgal_fit_method_t fit_method, sfcgal_knot_method_t knot_method, sfcgal_end_condition_t end_condition, double tolerance, size_t max_control_points)
 Unified curve fitting interface. More...
 
SFCGAL_API size_t sfcgal_nurbs_curve_num_control_points (const sfcgal_geometry_t *curve)
 Returns the number of control points of a NURBS curve. More...
 
SFCGAL_API const sfcgal_geometry_t * sfcgal_nurbs_curve_control_point_n (const sfcgal_geometry_t *curve, size_t index)
 Returns the ith control point of a NURBS curve. More...
 
SFCGAL_API void sfcgal_nurbs_curve_set_control_point_n (sfcgal_geometry_t *curve, size_t index, const sfcgal_geometry_t *point)
 Sets the ith control point of a NURBS curve. More...
 
SFCGAL_API double sfcgal_nurbs_curve_weight_n (const sfcgal_geometry_t *curve, size_t index)
 Returns the weight at index of a NURBS curve. More...
 
SFCGAL_API void sfcgal_nurbs_curve_set_weight_n (sfcgal_geometry_t *curve, size_t index, double weight)
 Sets the weight at index of a NURBS curve. More...
 
SFCGAL_API unsigned int sfcgal_nurbs_curve_degree (const sfcgal_geometry_t *curve)
 Returns the degree of a NURBS curve. More...
 
SFCGAL_API size_t sfcgal_nurbs_curve_num_knots (const sfcgal_geometry_t *curve)
 Returns the number of knots in the knot vector of a NURBS curve. More...
 
SFCGAL_API double sfcgal_nurbs_curve_knot_n (const sfcgal_geometry_t *curve, size_t index)
 Returns the knot value at index of a NURBS curve. More...
 
SFCGAL_API int sfcgal_nurbs_curve_is_rational (const sfcgal_geometry_t *curve)
 Tests if a NURBS curve is rational (uses non-uniform weights) More...
 
SFCGAL_API int sfcgal_nurbs_curve_is_bezier (const sfcgal_geometry_t *curve)
 Tests if a NURBS curve is in Bezier form. More...
 
SFCGAL_API int sfcgal_nurbs_curve_is_bspline (const sfcgal_geometry_t *curve)
 Tests if a NURBS curve is a B-spline (uniform weights) More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_evaluate (const sfcgal_geometry_t *curve, double parameter)
 Evaluates a point on the NURBS curve at given parameter. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_derivative (const sfcgal_geometry_t *curve, double parameter, unsigned int order)
 Computes the derivative of a NURBS curve at given parameter. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_to_linestring (const sfcgal_geometry_t *curve, unsigned int num_segments)
 Converts a NURBS curve to a LineString with specified number of segments. More...
 
SFCGAL_API sfcgal_geometry_t * sfcgal_nurbs_curve_to_linestring_adaptive (const sfcgal_geometry_t *curve, double tolerance, unsigned int min_segments, unsigned int max_segments)
 Converts a NURBS curve to a LineString with adaptive tessellation. More...
 

Detailed Description

Typedef Documentation

typedef int(* sfcgal_error_handler_t) (const char *,...)

Warning and error handlers.

typedef void sfcgal_geometry_t

sfcgal_geometry_t is an opaque pointer type that is used to represent a pointer to SFCGAL::Geometry

Opaque type that represents the C++ type SFCGAL::PreparedGeometry.

typedef void sfcgal_primitive_t

sfcgal_primitive_t is an opaque pointer type that is used to represent a pointer to SFCGAL::Primitive

typedef uint32_t srid_t

SRID type.

Enumeration Type Documentation

Buffer3D types.

Enumerator
SFCGAL_BUFFER3D_ROUND 
SFCGAL_BUFFER3D_CYLSPHERE 
SFCGAL_BUFFER3D_FLAT 

End conditions for curve fitting and interpolation.

Enumerator
SFCGAL_END_CONDITION_CLAMPED 
SFCGAL_END_CONDITION_NATURAL 
SFCGAL_END_CONDITION_PERIODIC 
SFCGAL_END_CONDITION_TANGENT 

Curve fitting methods.

Enumerator
SFCGAL_FIT_METHOD_INTERPOLATE 
SFCGAL_FIT_METHOD_APPROXIMATE 

Geometric types.

Enumerator
SFCGAL_TYPE_POINT 
SFCGAL_TYPE_LINESTRING 
SFCGAL_TYPE_POLYGON 
SFCGAL_TYPE_MULTIPOINT 
SFCGAL_TYPE_MULTILINESTRING 
SFCGAL_TYPE_MULTIPOLYGON 
SFCGAL_TYPE_GEOMETRYCOLLECTION 
SFCGAL_TYPE_POLYHEDRALSURFACE 
SFCGAL_TYPE_TRIANGULATEDSURFACE 
SFCGAL_TYPE_TRIANGLE 
SFCGAL_TYPE_NURBSCURVE 
SFCGAL_TYPE_SOLID 
SFCGAL_TYPE_MULTISOLID 

Knot vector generation methods for NURBS curves.

Enumerator
SFCGAL_KNOT_METHOD_UNIFORM 
SFCGAL_KNOT_METHOD_CHORD_LENGTH 
SFCGAL_KNOT_METHOD_CENTRIPETAL 

Primitive types.

Enumerator
SFCGAL_TYPE_INVALID 
SFCGAL_TYPE_BOX 
SFCGAL_TYPE_CONE 
SFCGAL_TYPE_CUBE 
SFCGAL_TYPE_CYLINDER 
SFCGAL_TYPE_SPHERE 
SFCGAL_TYPE_TORUS 

Roof type for sfcgal_geometry_generate_roof.

Enumerator
SFCGAL_ROOF_FLAT 
SFCGAL_ROOF_HIPPED 
SFCGAL_ROOF_SKILLION 
SFCGAL_ROOF_GABLE 

Simplification strategy for edge collapsing algorithms.

Enumerator
SFCGAL_SIMPLIFICATION_STRATEGY_EDGE_LENGTH 
SFCGAL_SIMPLIFICATION_STRATEGY_GARLAND_HECKBERT 
SFCGAL_SIMPLIFICATION_STRATEGY_LINDSTROM_TURK 

Function Documentation

SFCGAL_API sfcgal_geometry_t* sfcgal_approx_convex_partition_2 ( const sfcgal_geometry_t *  geom)

Returns the approximal convex partition of a geometry (polygon without hole)

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The approximal convex partition of geom
SFCGAL_API void sfcgal_free_buffer ( void *  buffer)

Delete a buffer previously allocated and returned by SFCGAL.

Parameters
buffera buffer previously allocated and returned by SFCGAL
SFCGAL_API const char* sfcgal_full_version ( void  )

Get full version (including CGAL and Boost versions)

Returns
SFCGAL version as string including CGAL and Boost versions
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_alpha_shapes ( const sfcgal_geometry_t *  geom,
double  alpha,
bool  allow_holes 
)

Returns the alpha shapes of geom.

Precondition
isValid(geom) == true
alpha >= 0
Postcondition
isValid(return) == true
Parameters
geomthe input geometry
alphaIt can have values from 0 to infinity. Smaller alpha values produce more concave results. Alpha values greater than some data-dependent value produce the convex hull of the input.
allow_holesdefines whether alpha shapes are allowed to contain holes
Returns
A geometry representing the alpha shapes of the geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_alpha_wrapping_3d ( const sfcgal_geometry_t *  geom,
size_t  relative_alpha,
size_t  relative_offset 
)

Returns the 3D alpha wrapping of a geometry.

Precondition
isValid(geom) == true
relative_alpha >= 0
relative_offset >= 0
Postcondition
isValid(return) == true
Parameters
geominput geometry
relative_alphaThis parameter is used to determine which features will appear in the output. A small relative_alpha will produce an output less complex but less faithful to the input.
relative_offsetThis parameter controls the tightness of the result. A large relative_offset 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 SFCGAL::PolyhedralSurface representing the 3D alpha wrapping of the geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_approximate_medial_axis ( const sfcgal_geometry_t *  geom)

Returns the approximate medial axis for the given SFCGAL::Polygon Approximate medial axis is based on straight skeleton.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
A SFCGAL::MultiLineString representing the approximate medial axis of geom
SFCGAL_API double sfcgal_geometry_area ( const sfcgal_geometry_t *  geom)

Returns the area of geom.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
The area of geom
SFCGAL_API double sfcgal_geometry_area_3d ( const sfcgal_geometry_t *  geom)

Returns the 3D area of geom.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
The 3D area of geom
SFCGAL_API void sfcgal_geometry_as_geojson ( const sfcgal_geometry_t *  geom,
bool  strict,
int  precision,
bool  include_bbox,
char **  buffer,
size_t *  len 
)

Convert a Geometry to its GeoJSON representation.

Parameters
[in]geomthe input geometry
[in]strictIf true, output strictly RFC 7946 compliant GeoJSON. Non-standard types (TIN, Solid, etc.) are converted to standard types. If false, use SFCGAL type names as extensions (allows round-trip).
[in]precisionNumber of decimal places for coordinates. -1 means full precision.
[in]include_bboxInclude bounding box in output.
[out]bufferThe output buffer
[out]lenThe size of buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
Note
M values are dropped
SFCGAL_API void sfcgal_geometry_as_hexwkb ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Returns a WKB representation as hexadecimal of the given geometry.

Parameters
geomthe input geometry
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_obj ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Creates a OBJ string of the given geometry The generated OBJ string uses the Z-up convention.

Parameters
[in]geomthe input geometry
[out]bufferthe OBJ buffer
[out]lenthe size of buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_obj_file ( const sfcgal_geometry_t *  geom,
const char *  filename 
)

Creates a OBJ file of the given geometry The generated OBJ file uses the Z-up convention.

Parameters
geomthe input geometry
filenameOBJ filename
SFCGAL_API void sfcgal_geometry_as_stl ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Creates a STL string of the given geometry The generated STL string uses the Z-up convention.

Parameters
[in]geomthe input geometry
[out]bufferthe STL buffer
[out]lenthe size of buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_stl_file ( const sfcgal_geometry_t *  geom,
const char *  filename 
)

Creates a STL file of the given geometry The generated STL file uses the Z-up convention.

Parameters
geomthe input geometry
filenameSTL filename
SFCGAL_API void sfcgal_geometry_as_text ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Returns a WKT representation of the given geometry using CGAL exact integer fractions as coordinate values.

Parameters
geomthe input geometry
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_text_decim ( const sfcgal_geometry_t *  geom,
int  num_decimals,
char **  buffer,
size_t *  len 
)

Returns a WKT representation of the given geometry using floating point coordinate values.

Floating point precision can be set via the num_decimals parameter. Setting num_decimals to -1 yields the same result as sfcgal_geometry_as_text()

Parameters
geomthe input geometry
num_decimalsdecimal precision
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_vtk ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Creates a VTK string of the given geometry.

Parameters
geomthe input geometry
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_geometry_as_vtk_file ( const sfcgal_geometry_t *  geom,
const char *  filename 
)

Creates a VTK file of the given geometry.

Parameters
geomthe input geometry
filenameVTK filename
SFCGAL_API void sfcgal_geometry_as_wkb ( const sfcgal_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Returns a WKB representation of the given geometry.

Parameters
geomthe input geometry
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_boundary ( const sfcgal_geometry_t *  geom)

Returns the boundary of geom.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
the caller is responsible for the boundary deallocation.
Returns
The boundary of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_buffer3d ( const sfcgal_geometry_t *  geom,
double  radius,
int  segments,
sfcgal_buffer3d_type_t  buffer_type 
)

Computes a 3D buffer around a geometry.

Parameters
geomThe input geometry (must be a SFCGAL::Point or SFCGAL::LineString)
radiusThe buffer radius
segmentsThe number of segments to use for approximating curved surfaces
buffer_typeThe type of buffer to compute (ROUND, CYLSPHERE, or FLAT)
Returns
A new geometry representing the 3D buffer
Precondition
isValid(geom) == true
radius > 0
segments > 3
Postcondition
isValid(return) == true
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A 3D buffer as a SFCGAL::PolyhedralSurface
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_centroid ( const sfcgal_geometry_t *  geom)

Returns a SFCGAL::Point representing the geometry centroid.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
A SFCGAL::Point representing the geometry centroid
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_centroid_3d ( const sfcgal_geometry_t *  geom)

Returns a SFCGAL::Point representing the geometry centroid.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
A SFCGAL::Point representing the 3D geometry centroid
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_chamfer ( const sfcgal_geometry_t *  solid,
const sfcgal_geometry_t *  edge,
double  radius,
double  radius_y,
double  epsilon 
)

Replace sharp edges of a solid with a flat bevelled face (chamfer).

Each matched edge is cut back by radius along both adjacent faces. When radius_y differs from radius the bevel is asymmetric: one leg has length radius, the other radius_y.

Parameters
solidThe input SFCGAL::Solid
edgeSFCGAL::LineString or SFCGAL::MultiLineString selecting the edges to chamfer.
radiusLeg length on the first face.
radius_yLeg length on the second face. If negative, defaults to radius (symmetric chamfer).
epsilonTolerance (in coordinate units) used to locate edge endpoints on the solid mesh.
Returns
Modified solid, or clone of input if no edges were chamfered
Precondition
isValid(solid) == true
radius > 0
epsilon > 0
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_clone ( const sfcgal_geometry_t *  geom)

Returns a deep clone of the given geometry.

Parameters
geomthe input geometry
Postcondition
returns a pointer to an allocated geometry that must be deallocated by sfcgal_geometry_delete()
Returns
The cloned geometry
SFCGAL_API void sfcgal_geometry_collection_add_geometry ( sfcgal_geometry_t *  collection,
sfcgal_geometry_t *  geometry 
)

Adds a Geometry to a given SFCGAL::GeometryCollection.

Parameters
collectionthe input geometry
geometrythe new geometry
Precondition
collection must be a SFCGAL::GeometryCollection
Postcondition
the ownership of the given geometry is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_collection_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::GeometryCollection.

Returns
An empty SFCGAL::GeometryCollection

Creates an empty SFCGAL::GeometryCollection.

SFCGAL_API const sfcgal_geometry_t* sfcgal_geometry_collection_geometry_n ( const sfcgal_geometry_t *  collection,
size_t  index 
)

Returns the ith geometry of a SFCGAL::GeometryCollection.

Parameters
collectionthe input geometry
indexindex of the geometry in the collection
Precondition
collection is a SFCGAL::GeometryCollection
index >= 0 and index < sfcgal_geometry_collection_num_geometries
Postcondition
the returned Geometry is not writable and must not be deallocated by the caller
Returns
the ith geometry of the collection
SFCGAL_API size_t sfcgal_geometry_collection_num_geometries ( const sfcgal_geometry_t *  collection)

Returns the number of geometries of a given SFCGAL::GeometryCollection.

Parameters
collectionthe input geometry
Precondition
collection is a SFCGAL::GeometryCollection
Returns
the number of geometries of a given SFCGAL::GeometryCollection
Deprecated:
Use sfcgal_geometry_num_geometries() instead
SFCGAL_API void sfcgal_geometry_collection_set_geometry_n ( sfcgal_geometry_t *  collection,
sfcgal_geometry_t *  geometry,
size_t  index 
)

Set the ith geometry of a given SFCGAL::GeometryCollection.

Parameters
collectionthe input geometry
geometrythe new geometry
indexindex of the geometry in the collection
Precondition
collection is a SFCGAL::GeometryCollection
index >= 0 and index < sfcgal_geometry_num_geometries( collection )
Postcondition
The ownership of the geometry is taken. The caller is not responsible anymore of its deallocation.
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_convexhull ( const sfcgal_geometry_t *  geom)

Returns the convex hull of geom.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 2D convex hull of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_convexhull_3d ( const sfcgal_geometry_t *  geom)

Returns the 3D convex hull of geom.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 3D convex hull of geom
SFCGAL_API int sfcgal_geometry_covers ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Tests the 2D coverage of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
1 if geom1 or geom2 2D covers the other (including if both cover each other), 0 otherwise.
SFCGAL_API int sfcgal_geometry_covers_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Tests the 3D coverage of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
1 if geom1 or geom2 3D covers the other (including if both cover each other), 0 otherwise.
SFCGAL_API void sfcgal_geometry_delete ( sfcgal_geometry_t *  geom)

Deletes a given geometry.

Parameters
geomthe input geometry
Precondition
the given pointer must have been previously allocated by a creation function
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_difference ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the difference of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The difference of both geometries
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_difference_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the 3D difference of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The 3D difference of both geometries
SFCGAL_API int sfcgal_geometry_dimension ( const sfcgal_geometry_t *  geom)

Returns the dimension of a given geometry ( 0 : punctual, 1 : curve, ...)

Parameters
geomthe input geometry
Returns
the dimension as an integer
SFCGAL_API double sfcgal_geometry_distance ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Computes the distance of the two given Geometry objects.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
The distance of the two given SFCGAL::Geometry
SFCGAL_API double sfcgal_geometry_distance_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Computes the 3D distance of the two given Geometry objects.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
The 3D distance of the two given SFCGAL::Geometry
SFCGAL_API int sfcgal_geometry_drop_m ( sfcgal_geometry_t *  geom)

Drops the m coordinate of the geometry.

Parameters
geomthe input geometry
Returns
1 if a M value was present and has been removed. 0 otherwise.
SFCGAL_API int sfcgal_geometry_drop_z ( sfcgal_geometry_t *  geom)

Drops the z coordinate of the geometry.

Parameters
geomthe input geometry
Returns
1 if a Z value was present and has been removed. 0 otherwise.
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_envelope ( const sfcgal_geometry_t *  geom)

Returns the envelope of geom.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 2D envelope of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_envelope_3d ( const sfcgal_geometry_t *  geom)

Returns the 3d envelope of geom.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 3D envelope of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude ( const sfcgal_geometry_t *  geom,
double  ex,
double  ey,
double  ez 
)

Returns an extrusion of the given Geometry.

Parameters
geomthe input geometry
exextrude value on x axis
eyextrude value on y axis
ezextrude value on z axis
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The extruded geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_polygon_straight_skeleton ( const sfcgal_geometry_t *  geom,
double  building_height,
double  roof_height 
)

Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon.

This algorithm constructs a roof with a 45-degree pitch and a maximum height of roof_height. The roof rises until either the roof faces meet or the height reaches roof_height, whichever occurs first. Therefore, roof_height is not guaranteed to be reached.

Parameters
geomthe input geometry
building_heightextrusion height of walls
roof_heightextrusion height of roof
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
roof_height != 0
Returns
The the union of the polygon z-extrusion
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_polygon_straight_skeleton_with_angles ( const sfcgal_geometry_t *  geom,
double  building_height,
double  roof_height,
const double *  angles,
const size_t *  angles_per_ring,
size_t  num_rings 
)

Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon, with custom per-edge angles.

This algorithm constructs a roof with custom slopes and a maximum height of roof_height. The roof rises until either the roof faces meet or the height reaches roof_height, whichever occurs first. Therefore, roof_height is not guaranteed to be reached.

Parameters
geomthe input geometry
building_heightextrusion height of walls
roof_heightextrusion height of roof
anglesflattened array of angles (in degrees) for each edge of each ring
angles_per_ringarray containing the number of angles for each ring
num_ringsnumber of rings (exterior + holes)
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
roof_height != 0
0 < angles[i] < 180 for all i
Returns
The union of the polygon z-extrusion and the extrude straight skeleton
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_polygon_straight_skeleton_with_weights ( const sfcgal_geometry_t *  geom,
double  building_height,
double  roof_height,
const double *  weights,
const size_t *  weights_per_ring,
size_t  num_rings 
)

Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given SFCGAL::Polygon, with custom per-edge weights.

This algorithm constructs a roof with custom edge weights and a maximum height of roof_height. The roof rises until either the roof faces meet or the height reaches roof_height, whichever occurs first. Therefore, roof_height is not guaranteed to be reached.

Parameters
geomthe input geometry
building_heightextrusion height of walls
roof_heightextrusion height of roof
weightsflattened array of weights (tan of angles) for each edge of each ring
weights_per_ringarray containing the number of weights for each ring
num_ringsnumber of rings (exterior + holes)
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
roof_height != 0
Returns
The union of the polygon z-extrusion and the extrude straight skeleton
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_straight_skeleton ( const sfcgal_geometry_t *  geom,
double  height 
)

Returns the extrude straight skeleton of the given SFCGAL::Polygon.

This algorithm constructs an extrusion with a 45-degree pitch and a maximum height of height. The height rises until either the extrusion faces meet or the height reaches height, whichever occurs first. Therefore, height is not guaranteed to be reached.

Parameters
geomthe input geometry
heightextrusion height
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height != 0
Returns
The extrude straight skeleton of geom
Note
This is equivalent to calling sfcgal_geometry_extrude_polygon_straight_skeleton(geom, 0, height)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_straight_skeleton_with_angles ( const sfcgal_geometry_t *  geom,
double  height,
const double *  angles,
const size_t *  angles_per_ring,
size_t  num_rings 
)

Returns the extrude straight skeleton for the given SFCGAL::Geometry with custom per-edge angles.

Parameters
geomthe input geometry
heightextrusion height
anglesflattened array of angles (in degrees) for each edge of each ring
angles_per_ringarray containing the number of angles for each ring
num_ringsnumber of rings (exterior + holes)
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height != 0
0 < angles[i] < 180 for all i
Returns
The extrude straight skeleton of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_extrude_straight_skeleton_with_weights ( const sfcgal_geometry_t *  geom,
double  height,
const double *  weights,
const size_t *  weights_per_ring,
size_t  num_rings 
)

Returns the extrude straight skeleton of the given SFCGAL::Polygon, with custom per-edge weights.

Parameters
geomthe input geometry
heightextrusion height
weightsflattened array of weights (tan of angles) for each edge of each ring
weights_per_ringarray containing the number of weights for each ring
num_ringsnumber of rings (exterior + holes)
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height != 0
Returns
The extrude straight skeleton of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_fillet ( const sfcgal_geometry_t *  solid,
const sfcgal_geometry_t *  edge,
double  radius,
int  segments,
double  epsilon 
)

Replace sharp edges of a solid with a smooth circular-arc fillet.

Each matched edge is replaced by a cylindrical surface of the given radius, approximated by segments planar faces.

Parameters
solidThe input SFCGAL::Solid
edgeSFCGAL::LineString or SFCGAL::MultiLineString selecting the edges to fillet.
radiusFillet radius.
segmentsNumber of planar faces approximating the arc. Typical values: 4 (coarse), 8 (default), 16+ (smooth).
epsilonTolerance (in coordinate units) used to locate edge endpoints on the solid mesh.
Returns
Modified solid, or clone of input if no edges were chamfered
Precondition
isValid(solid) == true
radius > 0
segments >= 2
epsilon > 0
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_force_lhr ( const sfcgal_geometry_t *  geom)

Force a Left Handed Rule on the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The LHR geometry
SFCGAL_API int sfcgal_geometry_force_m ( sfcgal_geometry_t *  geom,
double  default_m 
)

Adds a m-dimension to the geometry, initialized to a preset value.

Existing M values remains unchanged. This has no effect on empty geometries.

Parameters
geomthe input geometry
default_mm-value to use
Returns
1 if a M value was added. 0 otherwise.
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_force_rhr ( const sfcgal_geometry_t *  geom)

Force a Right Handed Rule on the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The RHR geometry
SFCGAL_API void sfcgal_geometry_force_valid ( sfcgal_geometry_t *  geom,
int  valid 
)

Sets the validity flag of the geometry.

FIXME We better have geometry constructors to directly build valid geometries

Parameters
geomthe input geometry
valid1 to force validity or 0 to force invalidity
SFCGAL_API int sfcgal_geometry_force_z ( sfcgal_geometry_t *  geom,
double  default_z 
)

Adds a z-dimension to the geometry, initialized to a preset value.

Existing Z values remains unchanged. This has no effect on empty geometries.

Parameters
geomthe input geometry
default_zz-value to use
Returns
1 if a Z value was added. 0 otherwise.
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_generate_flat_roof ( const sfcgal_geometry_t *  geom,
double  height 
)

Generate a flat roof from a polygon.

Parameters
geomthe input polygon
heightroof height
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height > 0
Returns
The flat roof geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_generate_gable_roof ( const sfcgal_geometry_t *  geom,
double  height,
double  slope_angle 
)

Generate a gable roof from a polygon.

Automatically detects gable ends (shortest edges become vertical).

Parameters
geomthe input polygon
heightroof height
slope_angleslope angle for non-gable edges in degrees
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height > 0
0 < slope_angle < 180
Returns
The gable roof geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_generate_hipped_roof ( const sfcgal_geometry_t *  geom,
double  height 
)

Generate a hipped roof from a polygon using straight skeleton.

Parameters
geomthe input polygon
heightroof height
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height > 0
Returns
The hipped roof geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_generate_roof ( const sfcgal_geometry_t *  geom,
sfcgal_roof_type_t  roof_type,
double  slope_angle,
double  height,
size_t  primary_edge_index 
)

Generate a roof from a polygon using a specified type.

Dispatches to flat, hipped, gable, or skillion roof generation.

Parameters
geomthe input polygon
roof_typeroof type (SFCGAL_ROOF_FLAT, SFCGAL_ROOF_HIPPED, SFCGAL_ROOF_SKILLION, or SFCGAL_ROOF_GABLE)
slope_angleslope angle in degrees for gable/skillion (default: 30)
heightroof height (default: 3.0)
primary_edge_indexindex of the sloped edge for skillion (default: 0)
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
Returns
The generated roof geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_generate_skillion_roof ( const sfcgal_geometry_t *  geom,
double  height,
double  slope_angle,
size_t  primary_edge_index 
)

Generate a skillion (mono-pitch) roof from a polygon.

Parameters
geomthe input polygon
heightroof height
slope_angleslope angle in degrees
primary_edge_indexindex of the sloped edge
Precondition
geom must be a SFCGAL::Polygon
isValid(geom) == true
height > 0
0 < slope_angle < 180
Returns
The skillion roof geometry
SFCGAL_API int sfcgal_geometry_has_validity_flag ( const sfcgal_geometry_t *  geom)

Gets the validity flag of the geometry.

Parameters
geomthe input geometry
Returns
the validity flag of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_insert_points_within_tolerance ( const sfcgal_geometry_t *  base,
const sfcgal_geometry_t *  source,
double  tolerance 
)

Insert points from source geometry into base geometry within tolerance.

This function densifies the base geometry by adding points from the source geometry where they are within the specified tolerance distance from the base geometry's segments.

Parameters
baseThe geometry to receive inserted points
sourceThe geometry providing points to insert
toleranceMaximum distance for a point to be considered for insertion
Returns
A new geometry with points inserted, or NULL on error
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_intersection ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the intersection of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The intersection of both geometries
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_intersection_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the 3D intersection of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The 3D intersection of both geometries
SFCGAL_API int sfcgal_geometry_intersects ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Tests the intersection of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
1 if geometries intersect in 2D. 0 otherwise.
SFCGAL_API int sfcgal_geometry_intersects_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Tests the 3D intersection of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Returns
1 if geometries intersect in 3D. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_3d ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is 3D or not.

Parameters
geomthe input geometry
Returns
1 if geom is 3d. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_almost_equals ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2,
double  tolerance 
)

Returns true if geom1 is almost equals to geom2.

For each point of geom1 there is a point in geom2 within tolerance distance.

Parameters
geom1the first geometry
geom2the second geometry
tolerancethe tolerance
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
1 if geometries are almost equal. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_closed ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is closed or not.

Parameters
geomthe input geometry
Returns
1 if geom is measured. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_complexity_detail ( const sfcgal_geometry_t *  geom,
char **  invalidity_reason,
sfcgal_geometry_t **  invalidity_location 
)
Deprecated:
Use sfcgal_geometry_is_valid_detail() instead.
Parameters
[in]geomthe input geometry
[out]invalidity_reasoninvalidity reason
[out]invalidity_locationinvalidity location
Returns
1 if geom is simple. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_empty ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is empty or not.

Parameters
geomthe input geometry
Returns
1 if geom is empty. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_equals ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns true if geom1 is equals to geom2.

For each point of geom1 there is a point in geom2.

Parameters
geom1first input geometry
geom2second input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
1 if geometries are equal. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_measured ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is measured (has an m) or not.

Parameters
geomthe input geometry
Returns
1 if geom is measured. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_planar ( const sfcgal_geometry_t *  geom)

Tests if the given Geometry is planar.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
1 if the geometry is planar. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_simple ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is simple or not.

Parameters
geomthe input geometry
Returns
1 if geom is simple. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_simple_detail ( const sfcgal_geometry_t *  geom,
char **  complexity_reason 
)

Tests if the given geometry is simple or not And return details in case of complexity.

Parameters
geomthe input geometry
complexity_reasoninput/output parameter. If non null, a null-terminated string could be allocated and contain reason of the complexity
Returns
1 if geom is simple. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_valid ( const sfcgal_geometry_t *  geom)

Tests if the given geometry is valid or not.

Parameters
geomthe input geometry
Returns
1 if the geometry is valid. 0 otherwise.
SFCGAL_API int sfcgal_geometry_is_valid_detail ( const sfcgal_geometry_t *  geom,
char **  invalidity_reason,
sfcgal_geometry_t **  invalidity_location 
)

Tests if the given geometry is valid or not And return details in case of invalidity.

Parameters
[in]geomthe input geometry
[out]invalidity_reasoninput/output parameter. If non null, a null-terminated string could be allocated and contain reason of the invalidity
[out]invalidity_locationinput/output parameter. If non null, a geometry could be allocated and contain the location of the invalidity
Returns
1 if the geometry is valid. 0 otherwise.
SFCGAL_API double sfcgal_geometry_length ( const sfcgal_geometry_t *  geom)

Returns the 2D length of geom.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 2D length of geom
SFCGAL_API double sfcgal_geometry_length_3d ( const sfcgal_geometry_t *  geom)

Returns the 3D length of geom.

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The 3D length of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_line_sub_string ( const sfcgal_geometry_t *  geom,
double  start,
double  end 
)

Returns the substring of the given SFCGAL::LineString between fractional distances.

Parameters
geomthe input geometry
startdistance from start to begin extraction
enddistance to end to end extraction
Precondition
isValid(geom) == true
geom is a Linestring
-1 <= start <= 1
-1 <= end <= 1
Postcondition
isValid(return) == true
Returns
A new SFCGAL::LineString representing the portion of the input line between startFrac and endFrac. If startFrac >= endFrac, the returned SFCGAL::LineString may be empty.
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_make_solid ( const sfcgal_geometry_t *  geom)

Convert a SFCGAL::PolyhedralSurface to a SFCGAL::Solid.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The converted geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_minkowski_sum ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the 2D minkowski sum geom1 + geom2.

Parameters
geom1the first input geometry
geom2the second input geometry (must be a Polygon)
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The minkowski sum of geom1 and geom2
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_minkowski_sum_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the 3D minkowski sum geom1 + geom2.

The Minkowski sum of two point sets A and B is defined as: A + B = { a + b : a in A, b in B }

Supports all 3D geometry types including Point, LineString, Polygon, Triangle, TriangulatedSurface, PolyhedralSurface, Solid, and collections.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The 3D minkowski sum of geom1 and geom2 (typically a PolyhedralSurface)
SFCGAL_API size_t sfcgal_geometry_num_geometries ( const sfcgal_geometry_t *  collection)

Returns the number of geometries of the given geometry collection.

Parameters
collectionthe input geometry
Precondition
geometry must be a SFCGAL::GeometryCollection. Otherwise, 1 is returned. For empty geometries 0 is returned.
Returns
the the number of geometries of geometryCollection
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_offset_polygon ( const sfcgal_geometry_t *  geom,
double  radius 
)

Returns the offset polygon of the given Geometry.

Parameters
geomthe input geometry
radiusoffset distance
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The offset polygon of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_optimal_alpha_shapes ( const sfcgal_geometry_t *  geom,
bool  allow_holes,
size_t  nb_components 
)

Returns the optimal alpha shapes of geom.

Precondition
isValid(geom) == true
alpha >= 0
nb_components >= 0
Postcondition
isValid(return) == true
Parameters
geomthe input geometry
allow_holesdefines whether alpha shapes are allowed to contain holes
nb_componentsthe number of connected components in the output geometry
Returns
A geometry representing the optimal alpha shapes of geom
SFCGAL_API int sfcgal_geometry_orientation ( const sfcgal_geometry_t *  geom)

Returns the orientation of the given SFCGAL::Polygon -1 for a counter clockwise orientation 1 for a clockwise orientation 0 for an invalid or undetermined orientation.

Parameters
geomthe input geometry
Precondition
geom is a SFCGAL::Polygon
isValid(geom) == true
Returns
The orientation of the geometry as an integer
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_projected_medial_axis ( const sfcgal_geometry_t *  geom)

Returns the projected medial axis for the given SFCGAL::Polygon Projected medial axis is based on approximate medial axis and extend end lines to polygon edges.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
A SFCGAL::MultiLineString representing the projected medial axis of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate ( const sfcgal_geometry_t *  geom,
double  angle 
)

Rotates a geometry in 2D around the origin (0,0) by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
Returns
The rotated geometry
Note
This is equivalent to calling sfcgal_geometry_rotate_2d(geom, angle, 0, 0)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_2d ( const sfcgal_geometry_t *  geom,
double  angle,
double  cx,
double  cy 
)

Rotates a geometry in 2D around a specified point by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
cxX-coordinate of the center point
cyY-coordinate of the center point
Returns
The rotated geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_3d ( const sfcgal_geometry_t *  geom,
double  angle,
double  ax,
double  ay,
double  az 
)

Rotates a geometry in 3D around a specified axis and origin (0, 0, 0) by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
axX-coordinate of the axis vector
ayY-coordinate of the axis vector
azZ-coordinate of the axis vector
Returns
The rotated geometry
Note
This is equivalent to calling sfcgal_geometry_rotate_3d_around_center(geom, angle, ax, ay, az, 0, 0, 0)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_3d_around_center ( const sfcgal_geometry_t *  geom,
double  angle,
double  ax,
double  ay,
double  az,
double  cx,
double  cy,
double  cz 
)

Rotates a geometry in 3D around a specified axis and center point by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
axX-coordinate of the axis vector
ayY-coordinate of the axis vector
azZ-coordinate of the axis vector
cxX-coordinate of the center point
cyY-coordinate of the center point
czZ-coordinate of the center point
Returns
The rotated geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_x ( const sfcgal_geometry_t *  geom,
double  angle 
)

Rotates a geometry in 3D around the X axis and origin (0, 0, 0) by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
Returns
The rotated geometry
Note
This is equivalent to calling sfcgal_geometry_rotate_3d_around_center(geom, angle, 1, 0, 0, 0, 0, 0)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_y ( const sfcgal_geometry_t *  geom,
double  angle 
)

Rotates a geometry around the Y axis and origin (0, 0, 0) by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
Returns
The rotated geometry
Note
This is equivalent to calling sfcgal_geometry_rotate_3d_around_center(geom, angle, 0, 1, 0, 0, 0, 0)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_rotate_z ( const sfcgal_geometry_t *  geom,
double  angle 
)

Rotates a geometry around the Z axis and origin (0, 0, 0) by a given angle.

Parameters
geomThe geometry to rotate
angleRotation angle in radians
Returns
The rotated geometry
Note
This is equivalent to calling sfcgal_geometry_rotate_3d_around_center(geom, angle, 0, 0, 1, 0, 0, 0)
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_round ( const sfcgal_geometry_t *  geom,
int  scale 
)

Round coordinates of the given Geometry.

Parameters
geomthe input geometry
scalerounding precision
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The rounded geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_scale ( const sfcgal_geometry_t *  geom,
double  scale 
)

Scale a geometry by a given factor.

Parameters
geomThe geometry to scale
scaleScale factor
Returns
The scaled geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_scale_3d ( const sfcgal_geometry_t *  geom,
double  sx,
double  sy,
double  sz 
)

Scale a geometry by different factors for each dimension.

Parameters
geomThe geometry to scale
sxScale factor for x dimension
syScale factor for y dimension
szScale factor for z dimension
Returns
The scaled geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_scale_3d_around_center ( const sfcgal_geometry_t *  geom,
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
geomThe geometry to scale
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
Returns
The scaled geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_simplify ( const sfcgal_geometry_t *  geom,
double  threshold,
bool  preserve_topology 
)

Simplify a geometry by simplifying the polylines it contains.

Parameters
geomthe geometry to simplify
thresholdthreshold parameter
preserve_topologypreserve the topology
Returns
The simplified geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_simplify_surface_edge_count ( const sfcgal_geometry_t *  geometry,
size_t  edge_count,
sfcgal_simplification_strategy_t  strategy 
)

Simplify a surface mesh using CGAL edge collapse algorithm.

The stop predicate is expressed as an edge quantity.

Parameters
geometryThe input geometry to simplify (must be a surface or solid)
edge_countWhen 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
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_simplify_surface_edge_ratio ( const sfcgal_geometry_t *  geometry,
double  edge_ratio,
sfcgal_simplification_strategy_t  strategy 
)

Simplify a surface mesh using CGAL edge collapse algorithm.

The stop predicate is expressed as a proportion between 0 and 1.

Parameters
geometryThe input geometry to simplify (must be a surface or solid)
edge_ratioThe simplification process stops when the edge count ratio is reached
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
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_split_3d ( const sfcgal_geometry_t *  geom,
double  ptx,
double  pty,
double  ptz,
double  normalx,
double  normaly,
double  normalz,
bool  close_geometries 
)

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

Parameters
geomThe input geometry to split
ptxX-coordinate of a point belonging to the splitting plane
ptyY-coordinate of a point belonging to the splitting plane
ptzZ-coordinate of a point belonging to the splitting plane
normalxX-coordinate of the normal vector of the splitting plane
normalyY-coordinate of the normal vector of the splitting plane
normalzZ-coordinate of the normal vector of the splitting plane
close_geometriesIf true, ensures resulting geometries are closed.
Returns
A GeometryCollection containing the split geometries, or an empty GeometryCollection if the plane does not intersect the geometry.
Precondition
isValid(geom) == true
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_straight_skeleton ( const sfcgal_geometry_t *  geom)

Returns the straight skeleton of the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The straight skeleton of the given Geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_straight_skeleton_distance_in_m ( const sfcgal_geometry_t *  geom)

Returns the straight skeleton of the given Geometry with the distance to the border as M coordinate.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The straight skeleton with the distance to the border as M coordinate
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_straight_skeleton_partition ( const sfcgal_geometry_t *  geom,
bool  auto_orientation 
)

Returns the straight skeleton partition for the given SFCGAL::Polygon.

Parameters
geomthe input geometry
auto_orientationif 1 try to find the best orientation
Precondition
isValid(geom) == true
geom must be a SFCGAL::Polygon, SFCGAL::Triangle or MultiPolygon
Postcondition
isValid(return) == true
Returns
A geometry representing the straight skeleton partition of geom
SFCGAL_API void sfcgal_geometry_swap_xy ( sfcgal_geometry_t *  geom)

Swaps the x and y coordinates of the geometry.

Parameters
geomthe input geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_tesselate ( const sfcgal_geometry_t *  geom)

Returns a tessellation of the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The tessellation of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_tessellate ( const sfcgal_geometry_t *  geom)

Returns a tessellation of the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The tessellation of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_transform ( const sfcgal_geometry_t *  geom,
const double *  matrix4x4 
)

Transform a geometry by a 3D matrix (4x4)

Parameters
geomthe geometry to transform
matrix4x4pointer onto 4x4 double matrix (column by column)
Returns
The transformed geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_translate_2d ( const sfcgal_geometry_t *  geom,
double  dx,
double  dy 
)

Translate a geometry by a 2D vector.

Parameters
geomthe geometry to translate
dxx component of the translation vector
dyy component of the translation vector
Returns
The translated geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_translate_3d ( const sfcgal_geometry_t *  geom,
double  dx,
double  dy,
double  dz 
)

Translate a geometry by a 3D vector.

Parameters
geomthe geometry to translate
dxx component of the translation vector
dyy component of the translation vector
dzz component of the translation vector
Returns
The translated geometry
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_triangulate_2dz ( const sfcgal_geometry_t *  geom)

Returns a triangulation of the given Geometry.

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The triangulation of geom
SFCGAL_API void sfcgal_geometry_type ( const sfcgal_geometry_t *  geom,
char **  type,
size_t *  type_len 
)

Returns the type of a given geometry as a string.

Parameters
geomthe input geometry
[out]typethe output buffer
[out]type_lenthe size of the buffer
Postcondition
type is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API sfcgal_geometry_type_t sfcgal_geometry_type_id ( const sfcgal_geometry_t *  geom)

Returns the type of a given geometry.

Parameters
geomthe input geometry
Returns
the type of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_union ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the union of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The union of both geometries
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_union_3d ( const sfcgal_geometry_t *  geom1,
const sfcgal_geometry_t *  geom2 
)

Returns the 3D union of geom1 and geom2.

Parameters
geom1the first input geometry
geom2the second input geometry
Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
Returns
The 3D union of both geometries
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_visibility_point ( const sfcgal_geometry_t *  polygon,
const sfcgal_geometry_t *  point 
)

Returns the visibility polygon of a SFCGAL::Point inside a SFCGAL::Polygon.

Parameters
polygoninput geometry
pointinput geometry
Precondition
polygon is a valid geometry
point must be inside polygon or on the boundary
Returns
The visibility polygon of point inside polygon
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_visibility_segment ( const sfcgal_geometry_t *  polygon,
const sfcgal_geometry_t *  point_a,
const sfcgal_geometry_t *  point_b 
)

build the visibility polygon of the segment [point_a ; point_b] on a SFCGAL::Polygon

Parameters
polygoninput geometry
point_ainput geometry
point_binput geometry
Precondition
polygon is a valid geometry
point_a and point_b must be vertices of poly, adjacents and respect the
Returns
A visibility polygon direction
SFCGAL_API double sfcgal_geometry_volume ( const sfcgal_geometry_t *  geom)

Returns the volume of geom (must be a volume)

Parameters
geomthe input geometry
Precondition
isValid(geom) == true
Returns
The volume of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_greene_approx_convex_partition_2 ( const sfcgal_geometry_t *  geom)

Returns the greene approximal convex partition of a geometry (polygon without hole)

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The greene approximal convex partition of geom
SFCGAL_API void sfcgal_init ( void  )

This function must be called before all the other one.

SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_io_read_binary_prepared ( const char *  str,
size_t  len 
)

Read a SFCGAL::PreparedGeometry from a binary representation.

Parameters
strThe string representing the geometry.
lenThe size of str
Postcondition
The returned prepared geometry must be deallocated by the caller with sfcgal_prepared_geometry_delete()
Returns
a SFCGAL::PreparedGeometry from its binary representation
SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_io_read_ewkt ( const char *  str,
size_t  len 
)

Parse an Extended Well-Known Text (EWKT) representation into a PreparedGeometry.

Parameters
strThe Well-Known Text (WKT) string representing the geometry.
lenThe size of str
Postcondition
The returned prepared geometry must be deallocated by the caller with
Precondition
sfcgal_prepared_geometry_delete
Returns
A SFCGAL::Geometry from the EWKT
SFCGAL_API sfcgal_geometry_t* sfcgal_io_read_geojson ( const char *  str,
size_t  len 
)

Parse a GeoJSON representation into a Geometry.

Supports Geometry, Feature, and FeatureCollection. For Feature/FeatureCollection, only the geometry part is extracted.

Parameters
strThe GeoJSON string representing the geometry.
lenThe size of str
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::Geometry from the GeoJSON
SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_io_read_geojson_prepared ( const char *  str,
size_t  len 
)

Parse a GeoJSON representation into a PreparedGeometry.

If CRS is specified in GeoJSON, extracts the EPSG code as SRID.

Parameters
strThe GeoJSON string representing the geometry.
lenThe size of str
Postcondition
The returned prepared geometry must be deallocated by the caller with
Precondition
sfcgal_prepared_geometry_delete
Returns
A SFCGAL::PreparedGeometry from the GeoJSON
SFCGAL_API sfcgal_geometry_t* sfcgal_io_read_obj ( const char *  str,
size_t  len 
)

Reads a geometry from an OBJ format string.

Parameters
[in]strThe OBJ format string
[in]lenThe size of str
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::Geometry from the OBJ string, or NULL on error
SFCGAL_API sfcgal_geometry_t* sfcgal_io_read_obj_file ( const char *  filename)

Reads a geometry from an OBJ file.

Parameters
[in]filenameThe path to the OBJ file
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::Geometry from the OBJ file, or NULL on error
SFCGAL_API sfcgal_geometry_t* sfcgal_io_read_wkb ( const char *  str,
size_t  len 
)

io::readWKB

Parse a Well-Known Binary (WKB) representation into a Geometry.

Parameters
strThe Well-Known Text (WKB) string representing the geometry.
lenThe size of str
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::Geometry from the WKB
SFCGAL_API sfcgal_geometry_t* sfcgal_io_read_wkt ( const char *  str,
size_t  len 
)

io::readWKT

Parse a Well-Known Text (WKT) representation into a Geometry.

Parameters
strThe Well-Known Text (WKT) string representing the geometry.
lenThe size of str
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::Geometry from the WKT
SFCGAL_API void sfcgal_io_write_binary_prepared ( const sfcgal_prepared_geometry_t *  geom,
char **  buffer,
size_t *  len 
)

Serialization.

Convert a Geometry to its binary representation.

Parameters
[in]geomthe prepared geometry
[out]bufferThe binary buffer
[out]lenThe size of buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_linestring_add_point ( sfcgal_geometry_t *  linestring,
sfcgal_geometry_t *  point 
)

Adds a point to a SFCGAL::LineString.

Parameters
linestringis the SFCGAL::LineString where the SFCGAL::Point has to be added to
pointis the SFCGAL::Point to add to the given SFCGAL::LineString
Postcondition
the ownership of SFCGAL::Point is taken by the function
SFCGAL_API void sfcgal_linestring_closes ( sfcgal_geometry_t *  linestring)

Closes the SCGAL::LineString if it is not already closed.

Parameters
linestringthe input SFCGAL::LineString to close
SFCGAL_API sfcgal_geometry_t* sfcgal_linestring_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::LineString.

Returns
an empty SFCGAL::LineString

Creates an empty SFCGAL::LineString.

SFCGAL_API size_t sfcgal_linestring_num_points ( const sfcgal_geometry_t *  linestring)

Returns the number of points of the given SFCGAL::LineString.

Parameters
linestringthe input geometry
Precondition
linestring must be a SFCGAL::LineString
Returns
the number of points of linestring
SFCGAL_API const sfcgal_geometry_t* sfcgal_linestring_point_n ( const sfcgal_geometry_t *  linestring,
size_t  index 
)

Returns the ith point of a given SFCGAL::LineString.

Parameters
linestringthe input SFCGAL::LineString
indexis the point index in the SFCGAL::LineString
Precondition
linestring must be a SFCGAL::LineString
index >= 0 and indx < sfcgal_linestring_num_points
Postcondition
the returned SFCGAL::Point is not writable and must not be deallocated by the caller
Returns
the ith point of linestring
SFCGAL_API sfcgal_geometry_t* sfcgal_multi_linestring_create ( void  )

Creates an empty SFCGAL::MultiLineString.

Returns
An empty SFCGAL::MultiLineString
SFCGAL_API sfcgal_geometry_t* sfcgal_multi_point_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::MultiPoint.

Returns
An empty SFCGAL::MultiPoint

Creates an empty SFCGAL::MultiPoint.

SFCGAL_API sfcgal_geometry_t* sfcgal_multi_polygon_create ( void  )

Creates an empty SFCGAL::MultiPolygon.

Returns
An empty SFCGAL::MultiPolygon
SFCGAL_API sfcgal_geometry_t* sfcgal_multi_solid_create ( void  )

Creates an empty SFCGAL::MultiSolid.

Returns
An empty SFCGAL::MultiSolid
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_approximate ( const sfcgal_geometry_t **  points,
size_t  num_points,
unsigned int  degree,
double  tolerance,
size_t  max_control_points 
)

Creates an approximating NURBS curve.

Parameters
pointsArray of points to approximate
num_pointsNumber of points
degreeTarget curve degree
toleranceMaximum allowed deviation
max_control_pointsMaximum control points to use
Returns
New NURBS curve geometry approximating the points
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API const sfcgal_geometry_t* sfcgal_nurbs_curve_control_point_n ( const sfcgal_geometry_t *  curve,
size_t  index 
)

Returns the ith control point of a NURBS curve.

Parameters
curvethe input NURBS curve
indexcontrol point index
Returns
The control point at the specified index
Precondition
curve must be a NURBS curve
index >= 0 and i < sfcgal_nurbs_curve_num_control_points
Postcondition
the returned Point is not writable and must not be deallocated by the caller
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create ( void  )

Creates an empty NURBS curve.

Returns
New empty NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_bezier ( const sfcgal_geometry_t **  points,
size_t  num_points 
)

Creates a NURBS curve from Bezier control points.

Parameters
pointsArray of Bezier control points
num_pointsNumber of control points
Returns
New NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_bspline ( const sfcgal_geometry_t **  points,
size_t  num_points,
unsigned int  degree 
)

Creates a uniform B-spline curve.

Parameters
pointsArray of control points
num_pointsNumber of control points
degreeSpline degree
Returns
New NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_circular_arc ( const sfcgal_geometry_t *  center,
double  radius,
double  start_angle,
double  end_angle,
const sfcgal_geometry_t *  normal 
)

Creates a circular arc as NURBS curve.

Parameters
centerArc center point
radiusArc radius (must be positive)
start_angleStart angle in radians
end_angleEnd angle in radians
normalNormal vector for 3D arcs (can be NULL for Z-axis)
Returns
New NURBS curve geometry representing the circular arc
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_from_full_data ( const sfcgal_geometry_t **  points,
const double *  weights,
size_t  num_points,
unsigned int  degree,
const double *  knots,
size_t  num_knots 
)

Creates a NURBS curve with full control over parameters.

Parameters
pointsArray of control points
weightsArray of weights (can be NULL for uniform weights)
num_pointsNumber of control points
degreePolynomial degree
knotsArray of knot values
num_knotsNumber of knot values (must equal num_points + degree + 1)
Returns
New NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_from_points ( const sfcgal_geometry_t **  points,
size_t  num_points,
unsigned int  degree,
sfcgal_knot_method_t  knot_method 
)

Creates a NURBS curve from control points with uniform weights.

Parameters
pointsArray of control points
num_pointsNumber of control points
degreePolynomial degree of curve
knot_methodMethod for generating knot vector
Returns
New NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_create_from_points_and_weights ( const sfcgal_geometry_t **  points,
const double *  weights,
size_t  num_points,
unsigned int  degree,
sfcgal_knot_method_t  knot_method 
)

Creates a NURBS curve from control points and weights.

Parameters
pointsArray of control points
weightsArray of weights (must match num_points)
num_pointsNumber of control points
degreePolynomial degree of curve
knot_methodMethod for generating knot vector
Returns
New NURBS curve geometry
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API unsigned int sfcgal_nurbs_curve_degree ( const sfcgal_geometry_t *  curve)

Returns the degree of a NURBS curve.

Parameters
curvethe input NURBS curve
Returns
The degree of the NURBS curve
Precondition
curve must be a NURBS curve
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_derivative ( const sfcgal_geometry_t *  curve,
double  parameter,
unsigned int  order 
)

Computes the derivative of a NURBS curve at given parameter.

Parameters
curvethe input NURBS curve
parameterparameter value
orderderivative order (1 for first derivative, 2 for second, etc.)
Returns
The derivative vector at the specified parameter
Precondition
curve must be a NURBS curve
Postcondition
The returned Point must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_evaluate ( const sfcgal_geometry_t *  curve,
double  parameter 
)

Evaluates a point on the NURBS curve at given parameter.

Parameters
curvethe input NURBS curve
parameterparameter value (between curve bounds)
Returns
The evaluated point on the curve
Precondition
curve must be a NURBS curve
Postcondition
The returned Point must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_fit ( const sfcgal_geometry_t **  points,
size_t  num_points,
unsigned int  degree,
sfcgal_fit_method_t  fit_method,
sfcgal_knot_method_t  knot_method,
sfcgal_end_condition_t  end_condition,
double  tolerance,
size_t  max_control_points 
)

Unified curve fitting interface.

Parameters
pointsArray of points to fit
num_pointsNumber of points
degreeTarget curve degree
fit_methodWhether to interpolate exactly or approximate
knot_methodParameterization method
end_conditionBoundary conditions (for interpolation)
toleranceMaximum deviation (for approximation, ignored otherwise)
max_control_pointsMaximum control points (for approximation)
Returns
New NURBS curve geometry fitted to the points
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_interpolate ( const sfcgal_geometry_t **  points,
size_t  num_points,
unsigned int  degree,
sfcgal_knot_method_t  knot_method,
sfcgal_end_condition_t  end_condition 
)

Creates an interpolating NURBS curve through points.

Parameters
pointsArray of points to interpolate through
num_pointsNumber of points
degreeCurve degree
knot_methodParameterization method
end_conditionBoundary conditions
Returns
New NURBS curve geometry interpolating through the points
Postcondition
The returned geometry must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API int sfcgal_nurbs_curve_is_bezier ( const sfcgal_geometry_t *  curve)

Tests if a NURBS curve is in Bezier form.

Parameters
curvethe input NURBS curve
Returns
1 if the curve is in Bezier form, 0 otherwise
Precondition
curve must be a NURBS curve
SFCGAL_API int sfcgal_nurbs_curve_is_bspline ( const sfcgal_geometry_t *  curve)

Tests if a NURBS curve is a B-spline (uniform weights)

Parameters
curvethe input NURBS curve
Returns
1 if the curve is a B-spline, 0 otherwise
Precondition
curve must be a NURBS curve
SFCGAL_API int sfcgal_nurbs_curve_is_rational ( const sfcgal_geometry_t *  curve)

Tests if a NURBS curve is rational (uses non-uniform weights)

Parameters
curvethe input NURBS curve
Returns
1 if the curve is rational, 0 otherwise
Precondition
curve must be a NURBS curve
SFCGAL_API double sfcgal_nurbs_curve_knot_n ( const sfcgal_geometry_t *  curve,
size_t  index 
)

Returns the knot value at index of a NURBS curve.

Parameters
curvethe input NURBS curve
indexknot index
Returns
The knot value at the specified index
Precondition
curve must be a NURBS curve
index >= 0 and i < sfcgal_nurbs_curve_num_knots
SFCGAL_API size_t sfcgal_nurbs_curve_num_control_points ( const sfcgal_geometry_t *  curve)

Returns the number of control points of a NURBS curve.

Parameters
curveThe NURBS curve geometry
Returns
Number of control points
Precondition
curve must be a NURBS curve
SFCGAL_API size_t sfcgal_nurbs_curve_num_knots ( const sfcgal_geometry_t *  curve)

Returns the number of knots in the knot vector of a NURBS curve.

Parameters
curvethe input NURBS curve
Returns
The number of knots in the knot vector
Precondition
curve must be a NURBS curve
SFCGAL_API void sfcgal_nurbs_curve_set_control_point_n ( sfcgal_geometry_t *  curve,
size_t  index,
const sfcgal_geometry_t *  point 
)

Sets the ith control point of a NURBS curve.

Parameters
curvethe NURBS curve to modify
indexcontrol point index
pointnew control point
Precondition
curve must be a NURBS curve
point must be a Point
index >= 0 and i < sfcgal_nurbs_curve_num_control_points
SFCGAL_API void sfcgal_nurbs_curve_set_weight_n ( sfcgal_geometry_t *  curve,
size_t  index,
double  weight 
)

Sets the weight at index of a NURBS curve.

Parameters
curvethe NURBS curve to modify
indexweight index
weightnew weight value (must be positive)
Precondition
curve must be a NURBS curve
index >= 0 and i < sfcgal_nurbs_curve_num_control_points
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_to_linestring ( const sfcgal_geometry_t *  curve,
unsigned int  num_segments 
)

Converts a NURBS curve to a LineString with specified number of segments.

Parameters
curvethe input NURBS curve
num_segmentsnumber of line segments
Returns
The converted LineString geometry
Precondition
curve must be a NURBS curve
Postcondition
The returned LineString must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API sfcgal_geometry_t* sfcgal_nurbs_curve_to_linestring_adaptive ( const sfcgal_geometry_t *  curve,
double  tolerance,
unsigned int  min_segments,
unsigned int  max_segments 
)

Converts a NURBS curve to a LineString with adaptive tessellation.

Parameters
curvethe input NURBS curve
tolerancemaximum deviation tolerance
min_segmentsminimum number of segments
max_segmentsmaximum number of segments
Returns
The converted LineString geometry
Precondition
curve must be a NURBS curve
Postcondition
The returned LineString must be deallocated by the caller with
Precondition
sfcgal_geometry_delete
SFCGAL_API double sfcgal_nurbs_curve_weight_n ( const sfcgal_geometry_t *  curve,
size_t  index 
)

Returns the weight at index of a NURBS curve.

Parameters
curvethe input NURBS curve
indexweight index
Returns
The weight value at the specified index
Precondition
curve must be a NURBS curve
index >= 0 and index < sfcgal_nurbs_curve_num_control_points
SFCGAL_API sfcgal_geometry_t* sfcgal_optimal_convex_partition_2 ( const sfcgal_geometry_t *  geom)

Returns the optimal convex partition of a geometry (polygon without hole)

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The optimal convex partition of geom
SFCGAL_API sfcgal_geometry_t* sfcgal_point_create ( void  ) -> sfcgal_geometry_t *

Creates an empty point.

Returns
an empty SFCGAL::Point

Creates an empty point.

SFCGAL_API sfcgal_geometry_t* sfcgal_point_create_from_xy ( double  x,
double  y 
)

Creates a point from two X and Y coordinates.

Parameters
xX coordinate
yY coordinate
Returns
a SFCGAL::Point with X, Y coordinates
SFCGAL_API sfcgal_geometry_t* sfcgal_point_create_from_xym ( double  x,
double  y,
double  m 
)

Creates a point from three X, Y and M coordinates.

Parameters
xX coordinate
yY coordinate
mM coordinate
Returns
a SFCGAL::Point with X, Y, M coordinates
SFCGAL_API sfcgal_geometry_t* sfcgal_point_create_from_xyz ( double  x,
double  y,
double  z 
)

Creates a point from three X, Y and Z coordinates.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
a SFCGAL::Point with X, Y, Z coordinates
SFCGAL_API sfcgal_geometry_t* sfcgal_point_create_from_xyzm ( double  x,
double  y,
double  z,
double  m 
)

Creates a point from four X, Y, Z and M coordinates.

Parameters
xX coordinate
yY coordinate
zZ coordinate
mM coordinate
Returns
a SFCGAL::Point with X, Y, Z, M coordinates
SFCGAL_API double sfcgal_point_m ( const sfcgal_geometry_t *  geom)

Returns the M coordinate of the given SFCGAL::Point.

Parameters
geomthe input geometry
Precondition
the given geometry must be a SFCGAL::Point
the given point must not be empty
Postcondition
the M coordinate can value NaN if the given point has no m
Returns
the M coordinate of the point
SFCGAL_API double sfcgal_point_x ( const sfcgal_geometry_t *  geom)

Returns the X coordinate of the given SFCGAL::Point.

Parameters
geomthe input geometry
Precondition
the given geometry must be a SFCGAL::Point
the given point must not be empty
Returns
the X coordinate of the point
SFCGAL_API double sfcgal_point_y ( const sfcgal_geometry_t *  geom)

Returns the Y coordinate of the given SFCGAL::Point.

Parameters
geomthe input geometry
Precondition
the given geometry must be a SFCGAL::Point
the given point must not be empty
Returns
the Y coordinate of the point
SFCGAL_API double sfcgal_point_z ( const sfcgal_geometry_t *  geom)

Returns the Z coordinate of the given SFCGAL::Point.

Parameters
geomthe input geometry
Precondition
the given geometry must be a SFCGAL::Point
the given point must not be empty
Postcondition
the Z coordinate can value NaN if the given point is 2D only
Returns
the Z coordinate of the point
SFCGAL_API void sfcgal_polygon_add_interior_ring ( sfcgal_geometry_t *  polygon,
sfcgal_geometry_t *  ring 
)

Adds an interior ring to a given SFCGAL::Polygon.

Parameters
polygonthe input geometry
ringthe new ring
Precondition
polygon must be a SFCGAL::Polygon
ring must be a SFCGAL::LineString
Postcondition
the ownership of the given ring is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API sfcgal_geometry_t* sfcgal_polygon_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::Polygon.

Returns
an empty SFCGAL::Polygon

Creates an empty SFCGAL::Polygon.

SFCGAL_API sfcgal_geometry_t* sfcgal_polygon_create_from_exterior_ring ( sfcgal_geometry_t *  ring)

Creates an empty SFCGAL::Polygon from an exterior ring.

Parameters
ringthe input geometry
Precondition
ring must be a SFCGAL::LineString
Postcondition
the ownership of the given ring is taken. The caller is not responsible anymore of its deallocation
Returns
a SFCGAL::Polygon with ring as exterior ring
SFCGAL_API const sfcgal_geometry_t* sfcgal_polygon_exterior_ring ( const sfcgal_geometry_t *  polygon)

Returns the exterior ring of a given SFCGAL::Polygon.

Parameters
polygonthe input geometry
Precondition
polygon must be a SFCGAL::Polygon
polygon must not be empty
Postcondition
the returned ring is a SFCGAL::LineString, is not writable and must not be deallocated by the caller
Returns
The exterior ing of polygon
SFCGAL_API const sfcgal_geometry_t* sfcgal_polygon_interior_ring_n ( const sfcgal_geometry_t *  polygon,
size_t  index 
)

Returns the ith interior ring of a given SFCGAL::Polygon.

Parameters
polygonthe input geometry
indexindex of the ring in the polygon
Precondition
polygon must be a SFCGAL::Polygon
index >= 0 and index < sfcgal_polygon_num_interior_rings
Postcondition
the returned ring is a SFCGAL::LineString, is not writable and must not be deallocated by the caller
Returns
The ith interior ring of polygon
SFCGAL_API size_t sfcgal_polygon_num_interior_rings ( const sfcgal_geometry_t *  polygon)

Returns the number of interior rings of a given SFCGAL::Polygon.

Parameters
polygonthe input geometry
Precondition
polygon must be a SFCGAL::Polygon
Returns
The number of interior rings of polygon
SFCGAL_API void sfcgal_polygon_set_exterior_ring ( sfcgal_geometry_t *  polygon,
sfcgal_geometry_t *  ring 
)

Sets the exterior ring of a given SFCGAL::Polygon.

Parameters
polygonthe input geometry
ringthe new exterior ring
Precondition
polygon must be a SFCGAL::Polygon
ring must be a SFCGAL::LineString
Postcondition
the ownership of the given ring is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API void sfcgal_polyhedral_surface_add_patch ( sfcgal_geometry_t *  polyhedral,
sfcgal_geometry_t *  patch 
)

Adds a patch to a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
patchthe new patch
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
patch must be a SFCGAL::Polygon
Postcondition
the ownership of the SFCGAL::Polygon is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API void sfcgal_polyhedral_surface_add_polygon ( sfcgal_geometry_t *  polyhedral,
sfcgal_geometry_t *  polygon 
)

Adds a SFCGAL::Polygon to a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
polygonthe new polygon
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
polygon must be a SFCGAL::Polygon
Postcondition
the ownership of the SFCGAL::Polygon is taken. The caller is not responsible anymore of its deallocation
Deprecated:
Use sfcgal_polyhedral_surface_add_patch() instead.
SFCGAL_API sfcgal_geometry_t* sfcgal_polyhedral_surface_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::PolyhedralSurface.

Returns
An empty SFCGAL::PolyhedralSurface

Creates an empty SFCGAL::PolyhedralSurface.

SFCGAL_API size_t sfcgal_polyhedral_surface_num_edges ( const sfcgal_geometry_t *  polyhedral)

Get the number of edges into a PolyhedralSurface.

Parameters
polyhedralthe input geometry
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
Returns
The number of edges of polyhedral
SFCGAL_API size_t sfcgal_polyhedral_surface_num_patches ( const sfcgal_geometry_t *  polyhedral)

Returns the number of patches of a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
Returns
The number of patches of polyhedral
SFCGAL_API size_t sfcgal_polyhedral_surface_num_polygons ( const sfcgal_geometry_t *  polyhedral)

Returns the number of polygons of a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
Returns
The number of patches of polyhedral
Deprecated:
Use sfcgal_polyhedral_surface_num_patches() instead.
SFCGAL_API const sfcgal_geometry_t* sfcgal_polyhedral_surface_patch_n ( const sfcgal_geometry_t *  polyhedral,
size_t  index 
)

Returns the ith patch of a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
indexindex of the patch in the polyhedral
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
index >= 0 and index < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition
the returned SFCGAL::Polygon is not writable and must not be deallocated by the caller
Returns
The ith patch of geom
SFCGAL_API const sfcgal_geometry_t* sfcgal_polyhedral_surface_polygon_n ( const sfcgal_geometry_t *  polyhedral,
size_t  index 
)

Returns the ith polygon of a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
indexindex of the patch in the polyhedral
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface
index >= 0 and index < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition
the returned SFCGAL::Polygon is not writable and must not be deallocated by the caller
Returns
The ith patch of geom
Deprecated:
Use sfcgal_polyhedral_surface_patch_n() instead
SFCGAL_API void sfcgal_polyhedral_surface_set_patch_n ( sfcgal_geometry_t *  polyhedral,
sfcgal_geometry_t *  patch,
size_t  index 
)

Set the ith patch of a given SFCGAL::PolyhedralSurface.

Parameters
polyhedralthe input geometry
patchthe new patch
indexindex of the patch in the polyhedral
Precondition
polyhedral must be a SFCGAL::PolyhedralSurface.
patch must be a SFCGAL::Polygon.
index >= 0 and index < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition
The ownership of the polygon is taken. The caller is not responsible anymore of its deallocation.
SFCGAL_API void sfcgal_prepared_geometry_as_ewkt ( const sfcgal_prepared_geometry_t *  prepared,
int  num_decimals,
char **  buffer,
size_t *  len 
)

Returns an EWKT representation of the given SFCGAL::PreparedGeometry.

Parameters
[in]preparedthe input geometry
[in]num_decimalsnumber of decimals. -2 for a variable number of decimals.
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API void sfcgal_prepared_geometry_as_geojson ( const sfcgal_prepared_geometry_t *  prepared,
bool  strict,
int  precision,
bool  include_bbox,
char **  buffer,
size_t *  len 
)

Convert a PreparedGeometry to its GeoJSON representation.

If SRID is non-zero, includes a CRS member (non-standard but useful).

Parameters
[in]preparedthe input prepared geometry
[in]strictIf true, output strictly RFC 7946 compliant GeoJSON. Non-standard types (TIN, Solid, etc.) are converted to standard types. If false, use SFCGAL type names as extensions (allows round-trip).
[in]precisionNumber of decimal places for coordinates. -1 means full precision.
[in]include_bboxInclude bounding box in output.
[out]bufferThe output buffer
[out]lenThe size of buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
Note
M values are dropped
SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_prepared_geometry_create ( void  )

Creates an empty SFCGAL::PreparedGeometry.

Returns
an empty SFCGAL::PreparedGeometry
SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_prepared_geometry_create_from_geometry ( sfcgal_geometry_t *  geometry,
srid_t  srid 
)

Creates a SFCGAL::PreparedGeometry from a Geometry and an SRID.

Parameters
geometrythe input geometry
sridthe srid of the geometry
Returns
a SFCGAL::PreparedGeometry
SFCGAL_API void sfcgal_prepared_geometry_delete ( sfcgal_prepared_geometry_t *  prepared)

Deletes a given SFCGAL::PreparedGeometry.

Parameters
preparedthe input geometry
Precondition
prepared must be a SFCGAL::PreparedGeometry
Postcondition
the underlying Geometry linked to the given PreparedGeometry is also deleted
SFCGAL_API const sfcgal_geometry_t* sfcgal_prepared_geometry_geometry ( const sfcgal_prepared_geometry_t *  prepared)

Returns the SFCGAL::Geometry associated with a given SFCGAL::PreparedGeometry.

Parameters
preparedthe input geometry
Precondition
prepared must be a SFCGAL::PreparedGeometry
Postcondition
the returned Geometry is not writable and must not be deallocated by the caller
Returns
the SFCGAL::Geometry of prepared
SFCGAL_API void sfcgal_prepared_geometry_set_geometry ( sfcgal_prepared_geometry_t *  prepared,
sfcgal_geometry_t *  geometry 
)

Sets the Geometry associated with the given SFCGAL::PreparedGeometry.

Parameters
preparedthe input geometry
geometrythe geometry to set
Precondition
prepared must be a SFCGAL::PreparedGeometry
Postcondition
the ownership of the given geometry is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API void sfcgal_prepared_geometry_set_srid ( sfcgal_prepared_geometry_t *  prepared,
srid_t  srid 
)

Sets SRID associated with a given SFCGAL::PreparedGeometry.

Parameters
preparedthe input geometry
sridthe srid of the geometry
Precondition
prepared must be a SFCGAL::PreparedGeometry
SFCGAL_API srid_t sfcgal_prepared_geometry_srid ( const sfcgal_prepared_geometry_t *  prepared)

Returns SRID associated with a given SFCGAL::PreparedGeometry.

Parameters
preparedthe input geometry
Precondition
prepared must be a SFCGAL::PreparedGeometry
Returns
the srid of prepared
SFCGAL_API double sfcgal_primitive_area ( const sfcgal_primitive_t *  prim,
bool  with_discretization 
)

Computes primitive area.

Parameters
primPointer to the input primitive.
with_discretizationIf true, the area is computed using the real discretization with radial segments. If false, the area is computed for a perfect primitive.
Returns
The primitive area
SFCGAL_API sfcgal_geometry_t* sfcgal_primitive_as_polyhedral_surface ( const sfcgal_primitive_t *  primitive)

Generates a polyhedral surface representation of the primitive.

Parameters
primitivePointer to the primitive.
Postcondition
The returned geometry must be deallocated by the caller with sfcgal_geometry_delete()
Returns
A SFCGAL::PolyhedralSurface representing the primitive
SFCGAL_API sfcgal_primitive_t* sfcgal_primitive_clone ( const sfcgal_primitive_t *  primitive)

Returns a deep clone of the given primitive.

Parameters
primitivePointer to the primitive.
Returns
a deep clone of the given primitive
Postcondition
returns a pointer to an allocated primitive that must be deallocated by sfcgal_primitive_delete()
SFCGAL_API sfcgal_primitive_t* sfcgal_primitive_create ( sfcgal_primitive_type_t  primitive_type)

Creates a new primitive of the specified type with default parameters.

Parameters
primitive_typeThe type of primitive to create.
Returns
A pointer to an allocated sfcgal_primitive_t object. The returned object must be freed by calling sfcgal_primitive_delete().
Postcondition
The returned pointer is non-NULL if allocation succeeds.
Returns
A SFCGAL::Primitive with default parameters
SFCGAL_API void sfcgal_primitive_delete ( sfcgal_primitive_t *  primitive)

Deletes a previously allocated primitive.

Parameters
primitivePointer to the primitive to delete.
Precondition
primitive must be a valid pointer returned by a creation function ( e.g. sfcgal_primitive_create() ).
Postcondition
After this call, the pointer is invalid and must not be used.
SFCGAL_API int sfcgal_primitive_is_almost_equals ( const sfcgal_primitive_t *  prim1,
const sfcgal_primitive_t *  prim2,
double  tolerance 
)

Returns true if prim1 is equals to prim2.

Checks for primitive type and parameters equality.

Parameters
prim1Pointer to the first primitive.
prim2Pointer to the second primitive.
tolerancethe tolerance
Returns
1 if primitives are almost equal. 0 otherwise.
SFCGAL_API void sfcgal_primitive_parameter ( const sfcgal_primitive_t *  primitive,
const char *  name,
char **  buffer,
size_t *  len 
)

Retrieves the primitive parameter name as JSON object { name, type, value }.

Parameters
primitivePointer to the primitive.
nameparameter name to retrieve
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()
SFCGAL_API double sfcgal_primitive_parameter_double ( const sfcgal_primitive_t *  primitive,
const char *  name 
)

Retrieves the value of a primitive parameter as a double.

Parameters
primitivePointer to the primitive.
nameName of the parameter to retrieve.
Returns
The parameter value as a double.
Precondition
The parameter identified by name must exist and be of type double.
Returns
Primitive parameter as a double
SFCGAL_API unsigned int sfcgal_primitive_parameter_int ( const sfcgal_primitive_t *  primitive,
const char *  name 
)

Retrieves the value of a primitive parameter as an unsigned int.

Parameters
primitivePointer to the primitive.
nameName of the parameter to retrieve.
Returns
The parameter value as an unsigned int.
Precondition
The parameter identified by name must exist and be of type unsigned int.
Returns
Primitive parameter as an unsigned int
SFCGAL_API void sfcgal_primitive_parameters ( const sfcgal_primitive_t *  primitive,
char **  buffer,
size_t *  len 
) -> void

Retrieves the list of primitive parameters as JSON array of { name, type, value }.

Parameters
primitivePointer to the primitive.
[out]bufferthe output buffer
[out]lenthe size of the buffer
Postcondition
buffer is returned allocated and must be freed by the caller with sfcgal_free_buffer()

Retrieves the list of primitive parameters as JSON array of { name, type, value }.

SFCGAL_API sfcgal_primitive_t* sfcgal_primitive_rotate ( const sfcgal_primitive_t *  primitive,
double  angle,
double  ax,
double  ay,
double  az,
double  cx,
double  cy,
double  cz 
)

Rotates a primitive around a specified axis and center point by a given angle.

Parameters
primitiveThe primitive to rotate
angleRotation angle in radians
axX-coordinate of the axis vector
ayY-coordinate of the axis vector
azZ-coordinate of the axis vector
cxX-coordinate of the center point
cyY-coordinate of the center point
czZ-coordinate of the center point
Returns
The rotated geometry
SFCGAL_API sfcgal_primitive_t* sfcgal_primitive_scale ( const sfcgal_primitive_t *  primitive,
double  sx,
double  sy,
double  sz,
double  cx,
double  cy,
double  cz 
)

Scales a primitive by the given factor.

Parameters
primitiveThe primitive to scale
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
Returns
The rotated geometry
SFCGAL_API void sfcgal_primitive_set_parameter ( sfcgal_primitive_t *  primitive,
const char *  name,
const char *  json_value 
)

Sets the value of a primitive parameter name as JSON object { name, type, value }.

Parameters
primitivePointer to the primitive.
nameName of the parameter to set.
json_valueThe new parameter value as JSON strong.
Precondition
The parameter identified by name must exist.
SFCGAL_API void sfcgal_primitive_set_parameter_double ( sfcgal_primitive_t *  primitive,
const char *  name,
double  parameter 
)

Sets the value of a primitive parameter as a double.

Parameters
primitivePointer to the primitive.
nameName of the parameter to set.
parameterThe new parameter value.
Precondition
The parameter identified by name must exist and accept values of type double.
SFCGAL_API void sfcgal_primitive_set_parameter_int ( sfcgal_primitive_t *  primitive,
const char *  name,
unsigned int  parameter 
)

Sets the value of a primitive parameter as an unsigned int.

Parameters
primitivePointer to the primitive.
nameName of the parameter to set.
parameterThe new parameter value.
Precondition
The parameter identified by name must exist and accept values of type unsigned int.
SFCGAL_API double* sfcgal_primitive_transformation ( const sfcgal_primitive_t *  primitive)

Retrieves the primitive's current transformation matrix as an array.

Parameters
primitivePointer to the primitive.
Returns
A newly allocated array of doubles representing the current affine transformation on success, or nullptr on failure.
Postcondition
The returned array must be deallocated using sfcgal_free_buffer().
Note
The matrix is stored in column-major order (column by column).
SFCGAL_API sfcgal_primitive_t* sfcgal_primitive_translate ( const sfcgal_primitive_t *  primitive,
double  dx,
double  dy,
double  dz 
)

Translates a primitive by a 3D vector.

Parameters
primitivethe primitive to translate
dxx component of the translation vector
dyy component of the translation vector
dzz component of the translation vector
Returns
The translated primitive
SFCGAL_API sfcgal_primitive_type_t sfcgal_primitive_type_id ( const sfcgal_primitive_t *  primitive)

Returns the type of a given primtive.

Parameters
primitivethe input primitive
Returns
the type of primitive
SFCGAL_API double sfcgal_primitive_volume ( const sfcgal_primitive_t *  prim,
bool  with_discretization 
)

Computes primitive volume.

Parameters
primPointer to the input primitive.
with_discretizationIf true, the area is computed using the real discretization with radial segments. If false, the area is computed for a perfect primitive.
Returns
The primitive volume
SFCGAL_API void sfcgal_set_alloc_handlers ( sfcgal_alloc_handler_t  alloc_handler,
sfcgal_free_handler_t  free_handler 
)

Sets the allocation handlers.

These functions are called on memory allocation and deallocation.

Parameters
alloc_handleris the function to call for memory allocation. The default behaviour is to call malloc()
free_handleris the function to call for memory deallocation. The default behaviour is to call free()
SFCGAL_API void sfcgal_set_error_handlers ( sfcgal_error_handler_t  warning_handler,
sfcgal_error_handler_t  error_handler 
)

Sets the error handlers.

These callbacks are called on warning or error

Parameters
warning_handleris the printf-styled callback function that will be called when a function raises a warning. The default behaviour is to call printf.
error_handleris the printf-style callback function that will be called when a function generates an error. The default behaviour is to call printf.
SFCGAL_API void sfcgal_set_geometry_validation ( int  enabled)

Set the geometry validation mode.

Parameters
enabled1 for enabled, 0 for disabled.
Note
obsolete
Deprecated:
It is not used anymore. It has no effect.
SFCGAL_API void sfcgal_solid_add_interior_shell ( sfcgal_geometry_t *  solid,
sfcgal_geometry_t *  shell 
)

Adds a shell to a given SFCGAL::Solid.

Parameters
solidthe input geometry
shellthe new geometry
Precondition
solid must be a SFCGAL::Solid
shell must be a SFCGAL::PolyhedralSurface
Postcondition
the ownership of the shell is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API sfcgal_geometry_t* sfcgal_solid_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::Solid.

Returns
A SFCGAL::Solid

Creates an empty SFCGAL::Solid.

SFCGAL_API sfcgal_geometry_t* sfcgal_solid_create_from_exterior_shell ( sfcgal_geometry_t *  shell)

Creates a SFCGAL::Solid from an exterior shell.

Parameters
shellthe input geometry
Precondition
shell must be a SFCGAL::PolyhedralSurface
Postcondition
the ownership of the given shell is taken. The caller is not responsible anymore of its deallocation
Returns
A SFCGAL::Solid with shell as exterior shell
SFCGAL_API size_t sfcgal_solid_num_shells ( const sfcgal_geometry_t *  solid)

Returns the number of shells of a given SFCGAL::Solid.

Parameters
solidthe input geometry
Precondition
solid must be a SFCGAL::Solid
Returns
The number of shells of solid
SFCGAL_API void sfcgal_solid_set_exterior_shell ( sfcgal_geometry_t *  solid,
sfcgal_geometry_t *  shell 
)

Set the exterior shell of a given SFCGAL::Solid.

Parameters
solidthe input geometry
shellthe new geometry
Precondition
solid must be a SFCGAL::Solid
shell must be a SFCGAL::PolyhedralSurface
Postcondition
the ownership of the shell is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API const sfcgal_geometry_t* sfcgal_solid_shell_n ( const sfcgal_geometry_t *  solid,
size_t  index 
)

Returns the ith shell of a given SFCGAL::Solid.

Parameters
solidthe input geometry
indexindex of the shell in the solid
Precondition
solid must be a SFCGAL::Solid
indx >= 0 and index < sfcgal_solid_num_shells( tin )
Postcondition
the returned SFCGAL::PolyhedralSurface is not writable and must not be deallocated by the caller
Returns
The ith shell of solid
SFCGAL_API sfcgal_geometry_t* sfcgal_triangle_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::Triangle.

Returns
an empty SFCGAL::Triangle

Creates an empty SFCGAL::Triangle.

SFCGAL_API sfcgal_geometry_t* sfcgal_triangle_create_from_points ( const sfcgal_geometry_t *  pta,
const sfcgal_geometry_t *  ptb,
const sfcgal_geometry_t *  ptc 
)

Creates a SFCGAL::Triangle from three given SFCGAL::Point.

Parameters
ptafirst input point
ptbsecond input point
ptcthird input point
Precondition
pta must be a SFCGAL::Point
ptb must be a SFCGAL::Point
ptc must be a SFCGAL::Point
Postcondition
the ownership of the three points are not taken. The caller is still responsible of their deallocation
Returns
a SFCGAL::Triangle from SFCGAL::Point pta, ptb and ptc
SFCGAL_API void sfcgal_triangle_set_vertex ( sfcgal_geometry_t *  triangle,
int  index,
const sfcgal_geometry_t *  vertex 
)

Sets one vertex of a SFCGAL::Triangle.

Parameters
trianglethe input geometry
indexindex of the vertex in the triangle
vertexnew point
Precondition
triangle must be a SFCGAL::Triangle
vertex must be a SFCGAL::Point
index >= 0 and index < 3
Postcondition
the ownership of the vertex is not taken. The caller is still responsible of its deallocation.
SFCGAL_API void sfcgal_triangle_set_vertex_from_xy ( sfcgal_geometry_t *  triangle,
int  index,
double  x,
double  y 
)

Sets one vertex of a SFCGAL::Triangle from two coordinates.

Parameters
trianglethe input geometry
indexindex of the vertex in the triangle
xnew point x
ynew point y
Precondition
triangle must be a SFCGAL::Triangle
index >= 0 and index < 3
SFCGAL_API void sfcgal_triangle_set_vertex_from_xyz ( sfcgal_geometry_t *  triangle,
int  index,
double  x,
double  y,
double  z 
)

Sets one vertex of a SFCGAL::Triangle from three coordinates.

Parameters
trianglethe input geometry
indexindex of the vertex in the triangle
xnew point x
ynew point y
znew point z
Precondition
triangle must be a SFCGAL::Triangle
index >= 0 and index < 3
SFCGAL_API const sfcgal_geometry_t* sfcgal_triangle_vertex ( const sfcgal_geometry_t *  triangle,
int  index 
)

Returns one the SFCGAL::Triangle's vertex as a SFCGAL::Point.

Parameters
trianglethe input geometry
indexindex of the vertex in the triangle
Precondition
triangle must be a SFCGAL::Triangle
index >= 0 and index < 3
Postcondition
returns a pointer to one of the vertices as a SFCGAL::Point. This pointer is not writable and must not be deallocated by the caller
Returns
One the SFCGAL::Triangle's vertex as a SFCGAL::Point
SFCGAL_API void sfcgal_triangulated_surface_add_patch ( sfcgal_geometry_t *  tin,
sfcgal_geometry_t *  patch 
)

Adds a patch to a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
patchthe new patch
Precondition
tin must be a SFCGAL::TriangulatedSurface
patch must be a SFCGAL::Triangle
Postcondition
the ownership of the SFCGAL::Triangle is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API void sfcgal_triangulated_surface_add_triangle ( sfcgal_geometry_t *  tin,
sfcgal_geometry_t *  triangle 
)

Adds a SFCGAL::Triangle to a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
trianglethe new triangle
Precondition
tin must be a SFCGAL::TriangulatedSurface
triangle must be a SFCGAL::Triangle
Postcondition
the ownership of the SFCGAL::Triangle is taken. The caller is not responsible anymore of its deallocation
Deprecated:
Use sfcgal_triangulated_surface_add_patch() instead.
SFCGAL_API sfcgal_geometry_t* sfcgal_triangulated_surface_create ( void  ) -> sfcgal_geometry_t *

Creates an empty SFCGAL::TriangulatedSurface.

Returns
An empty SFCGAL::TriangulatedSurface

Creates an empty SFCGAL::TriangulatedSurface.

SFCGAL_API size_t sfcgal_triangulated_surface_num_edges ( const sfcgal_geometry_t *  tin)

Get the number of edges into a TriangulatedSurface.

Parameters
tinthe input geometry
Precondition
tin must be a SFCGAL::TriangulatedSurface
Returns
The number of edges of tin
SFCGAL_API size_t sfcgal_triangulated_surface_num_patches ( const sfcgal_geometry_t *  tin)

Returns the number of patches of a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
Precondition
tin must be a SFCGAL::TriangulatedSurface
Returns
the number of patches of tin
SFCGAL_API size_t sfcgal_triangulated_surface_num_triangles ( const sfcgal_geometry_t *  tin)

Returns the number of triangles of a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
Precondition
tin must be a SFCGAL::TriangulatedSurface
Returns
The number of patches of tin
Deprecated:
Use sfcgal_triangulated_surface_num_patches() instead.
SFCGAL_API const sfcgal_geometry_t* sfcgal_triangulated_surface_patch_n ( const sfcgal_geometry_t *  tin,
size_t  index 
)

Returns the ith patch of a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
indexindex of the patch in the tin
Precondition
tin must be a SFCGAL::TriangulatedSurface
index >= 0 and index < sfcgal_triangulated_surface_num_patches( tin )
Postcondition
the returned SFCGAL::Triangle is not writable and must not be deallocated by the caller
Returns
The ith patch of tin
SFCGAL_API void sfcgal_triangulated_surface_set_patch_n ( sfcgal_geometry_t *  tin,
sfcgal_geometry_t *  patch,
size_t  index 
)

Set the ith patch of a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
patchthe new patch
indexindex of the patch in the tin
Precondition
tin must be a SFCGAL::TriangulatedSurface
patch must be a SFCGAL::Triangle.
index >= 0 and index < sfcgal_triangulated_surface_num_patches( tin )
Postcondition
The ownership of the triangle is taken. The caller is not responsible anymore of its deallocation.
SFCGAL_API const sfcgal_geometry_t* sfcgal_triangulated_surface_triangle_n ( const sfcgal_geometry_t *  tin,
size_t  index 
)

Returns the ith SFCGAL::Triangle of a given SFCGAL::TriangulatedSurface.

Parameters
tinthe input geometry
indexindex of the patch in the tin
Precondition
tin must be a SFCGAL::TriangulatedSurface
index >= 0 and index < sfcgal_triangulated_surface_num_patches( tin )
Postcondition
the returned SFCGAL::Triangle is not writable and must not be deallocated by the caller
Returns
The ith patch of tin
Deprecated:
Use sfcgal_triangulated_surface_patch_n() instead.
SFCGAL_API const char* sfcgal_version ( void  )

Get version.

Returns
SFCGAL version as string
SFCGAL_API sfcgal_geometry_t* sfcgal_y_monotone_partition_2 ( const sfcgal_geometry_t *  geom)

Returns the y monotone partition of a geometry (polygon without hole)

Parameters
geominput geometry
Precondition
isValid(geom) == true
Postcondition
isValid(return) == true
Returns
The y monotone partition of geom