File sfcgal_c.cpp#
FileList > capi > sfcgal_c.cpp
Go to the source code of this file
#include "SFCGAL/Geometry.h"
#include "SFCGAL/GeometryCollection.h"
#include "SFCGAL/LineString.h"
#include "SFCGAL/MultiLineString.h"
#include "SFCGAL/MultiPoint.h"
#include "SFCGAL/MultiPolygon.h"
#include "SFCGAL/MultiSolid.h"
#include "SFCGAL/Point.h"
#include "SFCGAL/Polygon.h"
#include "SFCGAL/PolyhedralSurface.h"
#include "SFCGAL/PreparedGeometry.h"
#include "SFCGAL/Solid.h"
#include "SFCGAL/Triangle.h"
#include "SFCGAL/TriangulatedSurface.h"
#include "SFCGAL/version.h"
#include "SFCGAL/capi/sfcgal_c.h"
#include "SFCGAL/detail/io/Serialization.h"
#include "SFCGAL/io/OBJ.h"
#include "SFCGAL/io/STL.h"
#include "SFCGAL/io/ewkt.h"
#include "SFCGAL/io/vtk.h"
#include "SFCGAL/io/wkb.h"
#include "SFCGAL/io/wkt.h"
#include "sfcgal_c.h"
#include "SFCGAL/algorithm/alphaShapes.h"
#include "SFCGAL/algorithm/alphaWrapping3D.h"
#include "SFCGAL/algorithm/area.h"
#include "SFCGAL/algorithm/buffer3D.h"
#include "SFCGAL/algorithm/centroid.h"
#include "SFCGAL/algorithm/convexHull.h"
#include "SFCGAL/algorithm/covers.h"
#include "SFCGAL/algorithm/difference.h"
#include "SFCGAL/algorithm/distance.h"
#include "SFCGAL/algorithm/distance3d.h"
#include "SFCGAL/algorithm/extrude.h"
#include "SFCGAL/algorithm/force3D.h"
#include "SFCGAL/algorithm/forceMeasured.h"
#include "SFCGAL/algorithm/intersection.h"
#include "SFCGAL/algorithm/intersects.h"
#include "SFCGAL/algorithm/isSimple.h"
#include "SFCGAL/algorithm/isValid.h"
#include "SFCGAL/algorithm/length.h"
#include "SFCGAL/algorithm/lineSubstring.h"
#include "SFCGAL/algorithm/minkowskiSum.h"
#include "SFCGAL/algorithm/offset.h"
#include "SFCGAL/algorithm/partition_2.h"
#include "SFCGAL/algorithm/plane.h"
#include "SFCGAL/algorithm/rotate.h"
#include "SFCGAL/algorithm/scale.h"
#include "SFCGAL/algorithm/simplification.h"
#include "SFCGAL/algorithm/straightSkeleton.h"
#include "SFCGAL/algorithm/tesselate.h"
#include "SFCGAL/algorithm/translate.h"
#include "SFCGAL/algorithm/union.h"
#include "SFCGAL/algorithm/visibility.h"
#include "SFCGAL/algorithm/volume.h"
#include "SFCGAL/triangulate/triangulate2DZ.h"
#include "SFCGAL/detail/transform/ForceOrderPoints.h"
#include "SFCGAL/detail/transform/ForceZOrderPoints.h"
#include "SFCGAL/detail/transform/RoundTransform.h"
#include <cmath>
Public Functions#
Public Functions Documentation#
function sfcgal_free_buffer#
void sfcgal_free_buffer (
void * buffer
)
Delete a buffer previously allocated and returned by SFCGAL.
Parameters:
buffer
a buffer previously allocated and returned by SFCGAL
function sfcgal_full_version#
auto sfcgal_full_version ()
Get full version (including CGAL and Boost versions)
function sfcgal_geometry_as_hexwkb#
void sfcgal_geometry_as_hexwkb (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Returns a WKB representation as hexadecimal of the given geometry
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_geometry_as_obj#
void sfcgal_geometry_as_obj (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Creates a OBJ string of the given geometry
function sfcgal_geometry_as_obj_file#
void sfcgal_geometry_as_obj_file (
const sfcgal_geometry_t * pgeom,
const char * filename
)
Creates a OBJ file of the given geometry
function sfcgal_geometry_as_stl#
auto sfcgal_geometry_as_stl (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Creates a STL string of the given geometry
function sfcgal_geometry_as_stl_file#
auto sfcgal_geometry_as_stl_file (
const sfcgal_geometry_t * pgeom,
const char * filename
)
Creates a STL file of the given geometry
function sfcgal_geometry_as_text#
void sfcgal_geometry_as_text (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Returns a WKT representation of the given geometry using CGAL exact integer fractions as coordinate values
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_geometry_as_text_decim#
void sfcgal_geometry_as_text_decim (
const sfcgal_geometry_t * pgeom,
int numDecimals,
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 numDecimals parameter. Setting numDecimals to -1 yields the same result as sfcgal_geometry_as_text.
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_geometry_as_vtk#
auto sfcgal_geometry_as_vtk (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Creates a VTK string of the given geometry
function sfcgal_geometry_as_vtk_file#
auto sfcgal_geometry_as_vtk_file (
const sfcgal_geometry_t * pgeom,
const char * filename
)
Creates a VTK file of the given geometry
function sfcgal_geometry_as_wkb#
void sfcgal_geometry_as_wkb (
const sfcgal_geometry_t * pgeom,
char ** buffer,
size_t * len
)
Returns a WKB representation of the given geometry
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_geometry_clone#
auto sfcgal_geometry_clone (
const sfcgal_geometry_t * geom
)
Returns a deep clone of the given geometry
Postcondition:
returns a pointer to an allocated geometry that must be deallocated by sfcgal_geometry_delete
function sfcgal_geometry_collection_add_geometry#
void sfcgal_geometry_collection_add_geometry (
sfcgal_geometry_t * collection,
sfcgal_geometry_t * geometry
)
Adds a Geometry to a given GeometryCollection
Precondition:
collection must be a GeometryCollection
Postcondition:
the ownership of the given geometry is taken. The caller is not responsible anymore of its deallocation
function sfcgal_geometry_collection_create#
auto sfcgal_geometry_collection_create ()
Geometry collection
function sfcgal_geometry_collection_geometry_n#
auto sfcgal_geometry_collection_geometry_n (
const sfcgal_geometry_t * collection,
size_t i
)
Returns the ith geometry of a GeometryCollection
Precondition:
collection is a GeometryCollection
Precondition:
i >= 0 and i < sfcgal_geometry_collection_num_geometries
Postcondition:
the returned Geometry is not writable and must not be deallocated by the caller
function sfcgal_geometry_collection_num_geometries#
auto sfcgal_geometry_collection_num_geometries (
const sfcgal_geometry_t * collection
)
Returns the number of geometries of a given GeometryCollection
Precondition:
collection is a GeometryCollection
Deprecated
Use sfcgal_geometry_num_geometries instead
function sfcgal_geometry_collection_set_geometry_n#
auto sfcgal_geometry_collection_set_geometry_n (
sfcgal_geometry_t * collection,
sfcgal_geometry_t * geometry,
size_t i
)
Set the ith geometry of a given GeometryCollection
Precondition:
collection is a GeometryCollection
Precondition:
i >= 0 and i < sfcgal_geometry_num_geometries( collection )
Postcondition:
The ownership of the geometry is taken. The caller is not responsible anymore of its deallocation.
function sfcgal_geometry_delete#
void sfcgal_geometry_delete (
sfcgal_geometry_t * geom
)
Deletes a given geometry
Precondition:
the given pointer must have been previously allocated by a creation function
function sfcgal_geometry_dimension#
auto sfcgal_geometry_dimension (
const sfcgal_geometry_t * geom
)
Returns the dimension of a given geometry ( 0 : punctual, 1 : curve, ...)
function sfcgal_geometry_drop_m#
auto sfcgal_geometry_drop_m (
sfcgal_geometry_t * geom
)
Drops the m coordinate of the geometry
Postcondition:
returns 1 if a M value was present and has been removed. 0 otherwise.
function sfcgal_geometry_drop_z#
auto sfcgal_geometry_drop_z (
sfcgal_geometry_t * geom
)
Drops the z coordinate of the geometry
Postcondition:
returns 1 if a Z value was present and has been removed. 0 otherwise.
function sfcgal_geometry_force_m#
auto sfcgal_geometry_force_m (
sfcgal_geometry_t * geom,
double defaultM
)
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:
geom
the input geometrydefaultM
m-value to use
Postcondition:
returns 1 if a M value was added. 0 otherwise.
function sfcgal_geometry_force_z#
auto sfcgal_geometry_force_z (
sfcgal_geometry_t * geom,
double defaultZ
)
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:
geom
the input geometrydefaultZ
z-value to use
Postcondition:
returns 1 if a Z value was added. 0 otherwise.
function sfcgal_geometry_is_3d#
auto sfcgal_geometry_is_3d (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is 3D or not
function sfcgal_geometry_is_complexity_detail#
auto 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.
function sfcgal_geometry_is_empty#
auto sfcgal_geometry_is_empty (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is empty or not
function sfcgal_geometry_is_measured#
auto sfcgal_geometry_is_measured (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is measured (has an m) or not
function sfcgal_geometry_is_simple#
auto sfcgal_geometry_is_simple (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is simple or not
function sfcgal_geometry_is_simple_detail#
auto 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:
geom
the input geometrycomplexity_reason
input/output parameter. If non null, a null-terminated string could be allocated and contain reason of the complexity
function sfcgal_geometry_is_valid#
auto sfcgal_geometry_is_valid (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is valid or not
function sfcgal_geometry_is_valid_detail#
auto 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:
geom
the input geometryinvalidity_reason
input/output parameter. If non null, a null-terminated string could be allocated and contain reason of the invalidityinvalidity_location
input/output parameter. If non null, a geometry could be allocated and contain the location of the invalidity
function sfcgal_geometry_num_geometries#
auto sfcgal_geometry_num_geometries (
const sfcgal_geometry_t * geometryCollection
)
Returns the number of geometries of the given geometry collection
Precondition:
geometry must be a GeometryCollection. Otherwise, 1 is returned. For empty geometries 0 is returned.
function sfcgal_geometry_swap_xy#
auto sfcgal_geometry_swap_xy (
sfcgal_geometry_t * geom
)
Swaps the x and y coordinates of the geometry
function sfcgal_geometry_type#
auto sfcgal_geometry_type (
const sfcgal_geometry_t * geom,
char ** type,
size_t * typeLen
)
Returns the type of a given geometry as a string
Postcondition:
type is returned allocated and must be freed by the caller
function sfcgal_geometry_type_id#
auto sfcgal_geometry_type_id (
const sfcgal_geometry_t * geom
)
Returns the type of a given geometry
function sfcgal_init#
void sfcgal_init ()
This function must be called before all the other one.
function sfcgal_io_read_binary_prepared#
auto sfcgal_io_read_binary_prepared (
const char * str,
size_t len
)
function sfcgal_io_read_ewkt#
auto sfcgal_io_read_ewkt (
const char * str,
size_t len
)
function sfcgal_io_read_wkb#
auto sfcgal_io_read_wkb (
const char * str,
size_t len
)
io::readWKB
function sfcgal_io_read_wkt#
auto sfcgal_io_read_wkt (
const char * str,
size_t len
)
io::readWKT
function sfcgal_io_write_binary_prepared#
void sfcgal_io_write_binary_prepared (
const sfcgal_prepared_geometry_t * geom,
char ** buffer,
size_t * len
)
Serialization
function sfcgal_linestring_add_point#
void sfcgal_linestring_add_point (
sfcgal_geometry_t * linestring,
sfcgal_geometry_t * point
)
Adds a point to a LineString
Parameters:
linestring
is the LineString where the Point has to be added topoint
is the Point to add to the given LineString
Precondition:
i >= and i < sfcgal_linestring_num_points
Postcondition:
the ownership of Point is taken by the function
function sfcgal_linestring_create#
auto sfcgal_linestring_create ()
LineString
function sfcgal_linestring_num_points#
auto sfcgal_linestring_num_points (
const sfcgal_geometry_t * linestring
)
Returns the number of points of the given LineString
Precondition:
linestring must be a LineString
function sfcgal_linestring_point_n#
auto sfcgal_linestring_point_n (
const sfcgal_geometry_t * linestring,
size_t i
)
Returns the ith point of a given LineString
Parameters:
linestring
the input LineStringi
is the point index in the LineString
Precondition:
linestring must be a LineString
Precondition:
i >= and i < sfcgal_linestring_num_points
Postcondition:
the returned Point is not writable and must not be deallocated by the caller
function sfcgal_multi_linestring_create#
auto sfcgal_multi_linestring_create ()
Creates an empty MultiLineString
function sfcgal_multi_point_create#
auto sfcgal_multi_point_create ()
Multi-*
function sfcgal_multi_polygon_create#
auto sfcgal_multi_polygon_create ()
Creates an empty MultiPolygon
function sfcgal_multi_solid_create#
auto sfcgal_multi_solid_create ()
Creates an empty MultiSolid
function sfcgal_point_create#
auto sfcgal_point_create ()
Point
function sfcgal_point_create_from_xy#
auto sfcgal_point_create_from_xy (
double x,
double y
)
Creates a point from two X and Y coordinates
function sfcgal_point_create_from_xym#
auto sfcgal_point_create_from_xym (
double x,
double y,
double m
)
Creates a point from three X, Y and M coordinates
function sfcgal_point_create_from_xyz#
auto sfcgal_point_create_from_xyz (
double x,
double y,
double z
)
Creates a point from three X, Y and Z coordinates
function sfcgal_point_create_from_xyzm#
auto sfcgal_point_create_from_xyzm (
double x,
double y,
double z,
double m
)
Creates a point from four X, Y, Z and M coordinates
function sfcgal_point_m#
auto sfcgal_point_m (
const sfcgal_geometry_t * geom
)
Returns the M coordinate of the given Point
Precondition:
the given geometry must be a Point
Precondition:
the given point must not be empty
Postcondition:
the M coordinate can value NaN if the given point has no m
function sfcgal_point_x#
auto sfcgal_point_x (
const sfcgal_geometry_t * geom
)
Returns the X coordinate of the given Point
Precondition:
the given geometry must be a Point
Precondition:
the given point must not be empty
function sfcgal_point_y#
auto sfcgal_point_y (
const sfcgal_geometry_t * geom
)
Returns the Y coordinate of the given Point
Precondition:
the given geometry must be a Point
Precondition:
the given point must not be empty
function sfcgal_point_z#
auto sfcgal_point_z (
const sfcgal_geometry_t * geom
)
Returns the Z coordinate of the given Point
Precondition:
the given geometry must be a Point
Precondition:
the given point must not be empty
Postcondition:
the Z coordinate can value NaN if the given point is 2D only
function sfcgal_polygon_add_interior_ring#
void sfcgal_polygon_add_interior_ring (
sfcgal_geometry_t * polygon,
sfcgal_geometry_t * ring
)
Adds an interior ring to a given Polygon
Precondition:
polygon must be a Polygon
Precondition:
ring must be a LineString
Postcondition:
the ownership of the given ring is taken. The caller is not responsible anymore of its deallocation
function sfcgal_polygon_create#
auto sfcgal_polygon_create ()
Polygon
function sfcgal_polygon_create_from_exterior_ring#
auto sfcgal_polygon_create_from_exterior_ring (
sfcgal_geometry_t * ring
)
Creates an empty Polygon from an extrior ring
Precondition:
ring must be a LineString
Postcondition:
the ownership of the given ring is taken. The caller is not responsible anymore of its deallocation
function sfcgal_polygon_exterior_ring#
auto sfcgal_polygon_exterior_ring (
const sfcgal_geometry_t * polygon
)
Returns the exterior ring of a given Polygon
Precondition:
polygon must be a Polygon
Precondition:
polygon must not be empty
Postcondition:
the returned ring is a LineString, is not writable and must not be deallocated by the caller
function sfcgal_polygon_interior_ring_n#
auto sfcgal_polygon_interior_ring_n (
const sfcgal_geometry_t * polygon,
size_t i
)
Returns the ith interior ring of a given Polygon
Precondition:
polygon must be a Polygon
Precondition:
i >= 0 and i < sfcgal_polygon_num_interior_rings
Postcondition:
the returned ring is a LineString, is not writable and must not be deallocated by the caller
function sfcgal_polygon_num_interior_rings#
auto sfcgal_polygon_num_interior_rings (
const sfcgal_geometry_t * polygon
)
Returns the number of interior rings of a given Polygon
Precondition:
polygon must be a Polygon
function sfcgal_polyhedral_surface_add_patch#
void sfcgal_polyhedral_surface_add_patch (
sfcgal_geometry_t * polyhedral,
sfcgal_geometry_t * patch
)
Adds a Patch to a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
Precondition:
patch must be a Polygon
Postcondition:
the ownership of the Polygon is taken. The caller is not responsible anymore of its deallocation
function sfcgal_polyhedral_surface_add_polygon#
void sfcgal_polyhedral_surface_add_polygon (
sfcgal_geometry_t * polyhedral,
sfcgal_geometry_t * polygon
)
Adds a Polygon to a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
Precondition:
polygon must be a Polygon
Postcondition:
the ownership of the Polygon is taken. The caller is not responsible anymore of its deallocation
Deprecated
Use sfcgal_polyhedral_surface_add_patch instead.
function sfcgal_polyhedral_surface_create#
auto sfcgal_polyhedral_surface_create ()
Polyhedral surface
function sfcgal_polyhedral_surface_num_patches#
auto sfcgal_polyhedral_surface_num_patches (
const sfcgal_geometry_t * polyhedral
)
Returns the number of patches of a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
function sfcgal_polyhedral_surface_num_polygons#
auto sfcgal_polyhedral_surface_num_polygons (
const sfcgal_geometry_t * polyhedral
)
Returns the number of polygons of a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
Deprecated
Use sfcgal_polyhedral_surface_num_patches instead.
function sfcgal_polyhedral_surface_patch_n#
auto sfcgal_polyhedral_surface_patch_n (
const sfcgal_geometry_t * polyhedral,
size_t i
)
Returns the ith patch of a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
Precondition:
i >= 0 and i < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition:
the returned Polygon is not writable and must not be deallocated by the caller
function sfcgal_polyhedral_surface_polygon_n#
auto sfcgal_polyhedral_surface_polygon_n (
const sfcgal_geometry_t * polyhedral,
size_t i
)
Returns the ith polygon of a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface
Precondition:
i >= 0 and i < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition:
the returned Polygon is not writable and must not be deallocated by the caller
Deprecated
Use sfcgal_polyhedral_surface_patch_n instead
function sfcgal_polyhedral_surface_set_patch_n#
void sfcgal_polyhedral_surface_set_patch_n (
sfcgal_geometry_t * polyhedral,
sfcgal_geometry_t * patch,
size_t i
)
Set the ith patch of a given PolyhedralSurface
Precondition:
polyhedral must be a PolyhedralSurface.
Precondition:
patch must be a Polygon.
Precondition:
i >= 0 and i < sfcgal_polyhedral_surface_num_patches(polyhedral)
Postcondition:
The ownership of the polygon is taken. The caller is not responsible anymore of its deallocation.
function sfcgal_prepared_geometry_as_ewkt#
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 PreparedGeometry
Parameters:
prepared
the input geometrynum_decimals
number of decimals. -2 for a variable number of decimals.buffer
the EWKT bufferlen
the size of the buffer
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_prepared_geometry_create#
auto sfcgal_prepared_geometry_create ()
Creates an empty PreparedGeometry
function sfcgal_prepared_geometry_create_from_geometry#
auto sfcgal_prepared_geometry_create_from_geometry (
sfcgal_geometry_t * geometry,
srid_t srid
)
Creates a PreparedGeometry from a Geometry and an SRID
function sfcgal_prepared_geometry_delete#
void sfcgal_prepared_geometry_delete (
sfcgal_prepared_geometry_t * prepared
)
Deletes a given PreparedGeometry
Precondition:
prepared must be a PreparedGeometry
Postcondition:
the underlying Geometry linked to the given PreparedGeometry is also deleted
function sfcgal_prepared_geometry_geometry#
auto sfcgal_prepared_geometry_geometry (
const sfcgal_prepared_geometry_t * prepared
)
Returns the Geometry associated with a given PreparedGeometry
Precondition:
prepared must be a PreparedGeometry
Postcondition:
the returned Geometry is not writable and must not be deallocated by the caller
function sfcgal_prepared_geometry_set_geometry#
void sfcgal_prepared_geometry_set_geometry (
sfcgal_prepared_geometry_t * prepared,
sfcgal_geometry_t * geometry
)
Sets the Geometry associated with the given PreparedGeometry
Precondition:
prepared must be a PreparedGeometry
Postcondition:
the ownership of the given geometry is taken. The caller is not responsible anymore of its deallocation
function sfcgal_prepared_geometry_set_srid#
void sfcgal_prepared_geometry_set_srid (
sfcgal_prepared_geometry_t * prepared,
srid_t srid
)
Sets SRID associated with a given PreparedGeometry
Precondition:
prepared must be a PreparedGeometry
function sfcgal_prepared_geometry_srid#
auto sfcgal_prepared_geometry_srid (
const sfcgal_prepared_geometry_t * prepared
)
Returns SRID associated with a given PreparedGeometry
Precondition:
prepared must be a PreparedGeometry
function sfcgal_set_alloc_handlers#
void sfcgal_set_alloc_handlers (
sfcgal_alloc_handler_t malloc_handler,
sfcgal_free_handler_t free_handler
)
Sets the allocation handlers. These functions are called on memory allocation and deallocation.
Parameters:
malloc_handler
is the function to call for memory allocation. The default behaviour is to call malloc()free_handler
is the function to call for memory deallocation. The default behaviour is to call free()
function sfcgal_set_error_handlers#
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_handler
is the printf-styled callback function that will be called when a function raises a warning. The default behaviour is to call printf.error_handler
is the printf-style callback function that will be called when a function generates an error. The default behaviour is to call printf.
function sfcgal_set_geometry_validation#
void sfcgal_set_geometry_validation (
int enabled
)
Set the geometry validation mode
Note:
obsolete
function sfcgal_solid_add_interior_shell#
void sfcgal_solid_add_interior_shell (
sfcgal_geometry_t * solid,
sfcgal_geometry_t * shell
)
Adds a shell to a given Solid
Precondition:
solid must be a Solid
Precondition:
shell must be a PolyhedralSurface
Postcondition:
the ownership of the shell is taken. The caller is not responsible anymore of its deallocation
function sfcgal_solid_create#
auto sfcgal_solid_create ()
Solid
function sfcgal_solid_create_from_exterior_shell#
auto sfcgal_solid_create_from_exterior_shell (
sfcgal_geometry_t * shell
)
Creates a Solid from an exterior shell
Precondition:
ring must be a PolyhedralSurface
Postcondition:
the ownership of the given shell is taken. The caller is not responsible anymore of its deallocation
function sfcgal_solid_num_shells#
auto sfcgal_solid_num_shells (
const sfcgal_geometry_t * solid
)
Returns the number of shells of a given Solid
Precondition:
solid must be a Solid
function sfcgal_solid_set_exterior_shell#
void sfcgal_solid_set_exterior_shell (
sfcgal_geometry_t * solid,
sfcgal_geometry_t * shell
)
Set the exterior shell of a given Solid
Precondition:
solid must be a Solid
Precondition:
shell must be a PolyhedralSurface
Postcondition:
the ownership of the shell is taken. The caller is not responsible anymore of its deallocation
function sfcgal_solid_shell_n#
auto sfcgal_solid_shell_n (
const sfcgal_geometry_t * solid,
size_t i
)
Returns the ith shell of a given Solid
Precondition:
solid must be a Solid
Precondition:
i >= 0 and i < sfcgal_solid_num_shells( tin )
Postcondition:
the returned PolyhedralSurface is not writable and must not be deallocated by the caller
function sfcgal_triangle_create#
auto sfcgal_triangle_create ()
Triangle
function sfcgal_triangle_create_from_points#
auto sfcgal_triangle_create_from_points (
const sfcgal_geometry_t * pta,
const sfcgal_geometry_t * ptb,
const sfcgal_geometry_t * ptc
)
Creates a Triangle from three given Point
Precondition:
pta must be a Triangle
Precondition:
ptb must be a Triangle
Precondition:
ptc must be a Triangle
Postcondition:
the ownership of the three points are not taken. The caller is still responsible of their deallocation
function sfcgal_triangle_set_vertex#
void sfcgal_triangle_set_vertex (
sfcgal_geometry_t * triangle,
int i,
const sfcgal_geometry_t * vertex
)
Sets one vertex of a Triangle
Precondition:
triangle must be a Triangle
Precondition:
vertex must be a Point
function sfcgal_triangle_set_vertex_from_xy#
void sfcgal_triangle_set_vertex_from_xy (
sfcgal_geometry_t * triangle,
int i,
double x,
double y
)
Sets one vertex of a Triangle from two coordinates
Precondition:
triangle must be a Triangle
Precondition:
i >= 0 and i < 3
function sfcgal_triangle_set_vertex_from_xyz#
void sfcgal_triangle_set_vertex_from_xyz (
sfcgal_geometry_t * triangle,
int i,
double x,
double y,
double z
)
Sets one vertex of a Triangle from three coordinates
Precondition:
triangle must be a Triangle
Precondition:
i >= 0 and i < 3
function sfcgal_triangle_vertex#
auto sfcgal_triangle_vertex (
const sfcgal_geometry_t * triangle,
int i
)
Returns one the Triangle's vertex as a Point
Precondition:
triangle must be a Triangle
Precondition:
i >= 0 and i < 3
Postcondition:
returns a pointer to one of the vertices as a Point. This pointer is not writable and must not be deallocated by the caller
function sfcgal_triangulated_surface_add_patch#
void sfcgal_triangulated_surface_add_patch (
sfcgal_geometry_t * tin,
sfcgal_geometry_t * patch
)
Adds a Patch to a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Precondition:
patch must be a Triangle
Postcondition:
the ownership of the Triangle is taken. The caller is not responsible anymore of its deallocation
function sfcgal_triangulated_surface_add_triangle#
void sfcgal_triangulated_surface_add_triangle (
sfcgal_geometry_t * tin,
sfcgal_geometry_t * triangle
)
Adds a Triangle to a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Precondition:
triangle must be a Triangle
Postcondition:
the ownership of the Triangle is taken. The caller is not responsible anymore of its deallocation
Deprecated
Use sfcgal_triangulated_surface_add_patch instead.
function sfcgal_triangulated_surface_create#
auto sfcgal_triangulated_surface_create ()
Triangulated surface
function sfcgal_triangulated_surface_num_patches#
auto sfcgal_triangulated_surface_num_patches (
const sfcgal_geometry_t * tin
)
Returns the number of patches of a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
function sfcgal_triangulated_surface_num_triangles#
auto sfcgal_triangulated_surface_num_triangles (
const sfcgal_geometry_t * tin
)
Returns the number of triangles of a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Deprecated
Use sfcgal_triangulated_surface_num_patches instead.
function sfcgal_triangulated_surface_patch_n#
auto sfcgal_triangulated_surface_patch_n (
const sfcgal_geometry_t * tin,
size_t i
)
Returns the ith Patch of a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Precondition:
i >= 0 and i < sfcgal_triangulated_surface_num_patches( tin )
Postcondition:
the returned Triangle is not writable and must not be deallocated by the caller
function sfcgal_triangulated_surface_set_patch_n#
void sfcgal_triangulated_surface_set_patch_n (
sfcgal_geometry_t * tin,
sfcgal_geometry_t * patch,
size_t i
)
Set the ith patch of a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Precondition:
patch must be a Triangle.
Precondition:
i >= 0 and i < sfcgal_triangulated_surface_num_patches( tin )
Postcondition:
The ownership of the triangle is taken. The caller is not responsible anymore of its deallocation.
function sfcgal_triangulated_surface_triangle_n#
auto sfcgal_triangulated_surface_triangle_n (
const sfcgal_geometry_t * tin,
size_t i
)
Returns the ith Triangle of a given TriangulatedSurface
Precondition:
tin must be a TriangulatedSurface
Precondition:
i >= 0 and i < sfcgal_triangulated_surface_num_patches( tin )
Postcondition:
the returned Triangle is not writable and must not be deallocated by the caller
Deprecated
Use sfcgal_triangulated_surface_patch_n instead.
function sfcgal_version#
auto sfcgal_version ()
Get version
The documentation for this class was generated from the following file /builds/sfcgal/SFCGAL/src/capi/sfcgal_c.cpp