File sfcgal_c.h
FileList > capi > sfcgal_c.h
Go to the source code of this file
#include "SFCGAL/config.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Public Types
Type | Name |
---|---|
typedef void *(* | sfcgal_alloc_handler_t |
enum | sfcgal_buffer3d_type_t |
typedef int(* | sfcgal_error_handler_t |
typedef void(* | sfcgal_free_handler_t |
typedef void | sfcgal_geometry_t |
enum | sfcgal_geometry_type_t |
typedef void | sfcgal_prepared_geometry_t |
typedef uint32_t | srid_t |
Public Functions
Type | Name |
---|---|
SFCGAL_API sfcgal_geometry_t * | sfcgal_approx_convex_partition_2 (const sfcgal_geometry_t * geom) |
SFCGAL_API const char * | sfcgal_full_version () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_alpha_shapes (const sfcgal_geometry_t * geom, double alpha, bool allow_holes) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_approximate_medial_axis (const sfcgal_geometry_t * geom) |
SFCGAL_API double | sfcgal_geometry_area (const sfcgal_geometry_t * geom) |
SFCGAL_API double | sfcgal_geometry_area_3d (const sfcgal_geometry_t * geom) |
SFCGAL_API void | sfcgal_geometry_as_hexwkb (const sfcgal_geometry_t * pgeom, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_geometry_as_obj (const sfcgal_geometry_t * pgeom, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_geometry_as_obj_file (const sfcgal_geometry_t * pgeom, const char * filename) |
SFCGAL_API void | sfcgal_geometry_as_text (const sfcgal_geometry_t * pgeom, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_geometry_as_text_decim (const sfcgal_geometry_t * pgeom, int numDecimals, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_geometry_as_vtk (const sfcgal_geometry_t * pgeom, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_geometry_as_vtk_file (const sfcgal_geometry_t * pgeom, const char * filename) |
SFCGAL_API void | sfcgal_geometry_as_wkb (const sfcgal_geometry_t * pgeom, char ** buffer, size_t * len) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_buffer3d (const sfcgal_geometry_t * geom, double radius, int segments, sfcgal_buffer3d_type_t buffer_type) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_clone (const sfcgal_geometry_t * geom) |
SFCGAL_API void | sfcgal_geometry_collection_add_geometry (sfcgal_geometry_t * collection, sfcgal_geometry_t * geometry) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_collection_create () |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_geometry_collection_geometry_n (const sfcgal_geometry_t * collection, size_t i) |
SFCGAL_API size_t | sfcgal_geometry_collection_num_geometries (const sfcgal_geometry_t * collection) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_convexhull (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_convexhull_3d (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_covers (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API int | sfcgal_geometry_covers_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API void | sfcgal_geometry_delete (sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_difference (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_difference_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API double | sfcgal_geometry_distance (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API double | sfcgal_geometry_distance_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_extrude (const sfcgal_geometry_t * geom, double ex, double ey, double ez) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_extrude_polygon_straight_skeleton (const sfcgal_geometry_t * geom, double building_height, double roof_height) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_extrude_straight_skeleton (const sfcgal_geometry_t * geom, double height) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_force_lhr (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_force_rhr (const sfcgal_geometry_t * geom) |
SFCGAL_API void | sfcgal_geometry_force_valid (sfcgal_geometry_t * geom, int valid) |
SFCGAL_API int | sfcgal_geometry_has_validity_flag (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_intersection (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_intersection_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API int | sfcgal_geometry_intersects (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API int | sfcgal_geometry_intersects_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API int | sfcgal_geometry_is_3d (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_is_empty (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_is_measured (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_is_planar (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_is_valid (const sfcgal_geometry_t * geom) |
SFCGAL_API int | sfcgal_geometry_is_valid_detail (const sfcgal_geometry_t * geom, char ** invalidity_reason, sfcgal_geometry_t ** invalidity_location) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_line_sub_string (const sfcgal_geometry_t * geom, double start, double end) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_make_solid (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_minkowski_sum (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_offset_polygon (const sfcgal_geometry_t * geom, double radius) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_optimal_alpha_shapes (const sfcgal_geometry_t * geom, bool allow_holes, size_t nb_components) |
SFCGAL_API int | sfcgal_geometry_orientation (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate (const sfcgal_geometry_t * geom, double angle) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate_2d (const sfcgal_geometry_t * geom, double angle, double cx, double cy) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate_3d (const sfcgal_geometry_t * geom, double angle, double ax, double ay, double az) |
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) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate_x (const sfcgal_geometry_t * geom, double angle) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate_y (const sfcgal_geometry_t * geom, double angle) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_rotate_z (const sfcgal_geometry_t * geom, double angle) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_round (const sfcgal_geometry_t * geom, int r) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_scale (const sfcgal_geometry_t * geom, double s) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_scale_3d (const sfcgal_geometry_t * geom, double sx, double sy, double sz) |
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) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_straight_skeleton (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_straight_skeleton_distance_in_m (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_straight_skeleton_partition (const sfcgal_geometry_t * geom, bool autoOrientation) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_tesselate (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_translate_2d (sfcgal_geometry_t * geom, double dx, double dy) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_translate_3d (sfcgal_geometry_t * geom, double dx, double dy, double dz) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_triangulate_2dz (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_type_t | sfcgal_geometry_type_id (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_union (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_union_3d (const sfcgal_geometry_t * geom1, const sfcgal_geometry_t * geom2) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_visibility_point (const sfcgal_geometry_t * polygon, const sfcgal_geometry_t * point) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_geometry_visibility_segment (const sfcgal_geometry_t * polygon, const sfcgal_geometry_t * pointA, const sfcgal_geometry_t * pointB) build the visibility polygon of the segment [pointA ; pointB] on a Polygon |
SFCGAL_API double | sfcgal_geometry_volume (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_greene_approx_convex_partition_2 (const sfcgal_geometry_t * geom) |
SFCGAL_API void | sfcgal_init () |
SFCGAL_API sfcgal_prepared_geometry_t * | sfcgal_io_read_binary_prepared (const char * str, size_t l) |
SFCGAL_API sfcgal_prepared_geometry_t * | sfcgal_io_read_ewkt (const char * str, size_t len) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_io_read_wkb (const char * str, size_t len) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_io_read_wkt (const char * str, size_t len) |
SFCGAL_API void | sfcgal_io_write_binary_prepared (const sfcgal_prepared_geometry_t * geom, char ** buffer, size_t * len) |
SFCGAL_API void | sfcgal_linestring_add_point (sfcgal_geometry_t * linestring, sfcgal_geometry_t * point) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_linestring_create () |
SFCGAL_API size_t | sfcgal_linestring_num_points (const sfcgal_geometry_t * linestring) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_linestring_point_n (const sfcgal_geometry_t * linestring, size_t i) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_multi_linestring_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_multi_point_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_multi_polygon_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_multi_solid_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_optimal_convex_partition_2 (const sfcgal_geometry_t * geom) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_point_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_point_create_from_xy (double x, double y) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_point_create_from_xym (double x, double y, double m) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_point_create_from_xyz (double x, double y, double z) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_point_create_from_xyzm (double x, double y, double z, double m) |
SFCGAL_API double | sfcgal_point_m (const sfcgal_geometry_t * geom) |
SFCGAL_API double | sfcgal_point_x (const sfcgal_geometry_t * geom) |
SFCGAL_API double | sfcgal_point_y (const sfcgal_geometry_t * geom) |
SFCGAL_API double | sfcgal_point_z (const sfcgal_geometry_t * geom) |
SFCGAL_API void | sfcgal_polygon_add_interior_ring (sfcgal_geometry_t * polygon, sfcgal_geometry_t * ring) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_polygon_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_polygon_create_from_exterior_ring (sfcgal_geometry_t * ring) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_polygon_exterior_ring (const sfcgal_geometry_t * polygon) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_polygon_interior_ring_n (const sfcgal_geometry_t * polygon, size_t i) |
SFCGAL_API size_t | sfcgal_polygon_num_interior_rings (const sfcgal_geometry_t * polygon) |
SFCGAL_API void | sfcgal_polyhedral_surface_add_polygon (sfcgal_geometry_t * polyhedral, sfcgal_geometry_t * polygon) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_polyhedral_surface_create () |
SFCGAL_API size_t | sfcgal_polyhedral_surface_num_polygons (const sfcgal_geometry_t * polyhedral) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_polyhedral_surface_polygon_n (const sfcgal_geometry_t * polyhedral, size_t i) |
SFCGAL_API void | sfcgal_prepared_geometry_as_ewkt (const sfcgal_prepared_geometry_t * prepared, int num_decimals, char ** buffer, size_t * len) |
SFCGAL_API sfcgal_prepared_geometry_t * | sfcgal_prepared_geometry_create () |
SFCGAL_API sfcgal_prepared_geometry_t * | sfcgal_prepared_geometry_create_from_geometry (sfcgal_geometry_t * geometry, srid_t srid) |
SFCGAL_API void | sfcgal_prepared_geometry_delete (sfcgal_prepared_geometry_t * prepared) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_prepared_geometry_geometry (const sfcgal_prepared_geometry_t * prepared) |
SFCGAL_API void | sfcgal_prepared_geometry_set_geometry (sfcgal_prepared_geometry_t * prepared, sfcgal_geometry_t * geometry) |
SFCGAL_API void | sfcgal_prepared_geometry_set_srid (sfcgal_prepared_geometry_t * prepared, srid_t srid) |
SFCGAL_API srid_t | sfcgal_prepared_geometry_srid (const sfcgal_prepared_geometry_t * prepared) |
SFCGAL_API void | sfcgal_set_alloc_handlers (sfcgal_alloc_handler_t malloc_handler, sfcgal_free_handler_t free_handler) |
SFCGAL_API void | sfcgal_set_error_handlers (sfcgal_error_handler_t warning_handler, sfcgal_error_handler_t error_handler) |
SFCGAL_API void | sfcgal_set_geometry_validation (int enabled) |
SFCGAL_API void | sfcgal_solid_add_interior_shell (sfcgal_geometry_t * solid, sfcgal_geometry_t * shell) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_solid_create () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_solid_create_from_exterior_shell (sfcgal_geometry_t * shell) |
SFCGAL_API size_t | sfcgal_solid_num_shells (const sfcgal_geometry_t * solid) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_solid_shell_n (const sfcgal_geometry_t * solid, size_t i) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_triangle_create () |
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) |
SFCGAL_API void | sfcgal_triangle_set_vertex (sfcgal_geometry_t * triangle, int i, const sfcgal_geometry_t * vertex) |
SFCGAL_API void | sfcgal_triangle_set_vertex_from_xy (sfcgal_geometry_t * triangle, int i, double x, double y) |
SFCGAL_API void | sfcgal_triangle_set_vertex_from_xyz (sfcgal_geometry_t * triangle, int i, double x, double y, double z) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_triangle_vertex (const sfcgal_geometry_t * triangle, int i) |
SFCGAL_API void | sfcgal_triangulated_surface_add_triangle (sfcgal_geometry_t * tin, sfcgal_geometry_t * triangle) |
SFCGAL_API sfcgal_geometry_t * | sfcgal_triangulated_surface_create () |
SFCGAL_API size_t | sfcgal_triangulated_surface_num_triangles (const sfcgal_geometry_t * tin) |
SFCGAL_API const sfcgal_geometry_t * | sfcgal_triangulated_surface_triangle_n (const sfcgal_geometry_t * tin, size_t i) |
SFCGAL_API const char * | sfcgal_version () |
SFCGAL_API sfcgal_geometry_t * | sfcgal_y_monotone_partition_2 (const sfcgal_geometry_t * geom) |
Public Types Documentation
typedef sfcgal_alloc_handler_t
typedef void *(* sfcgal_alloc_handler_t) (size_t);
enum sfcgal_buffer3d_type_t
enum sfcgal_buffer3d_type_t {
SFCGAL_BUFFER3D_ROUND,
SFCGAL_BUFFER3D_CYLSPHERE,
SFCGAL_BUFFER3D_FLAT
};
Buffer3D types
typedef sfcgal_error_handler_t
typedef int(* sfcgal_error_handler_t) (const char *,...);
Warning and error handlers
typedef sfcgal_free_handler_t
typedef void(* sfcgal_free_handler_t) (void *);
typedef sfcgal_geometry_t
typedef void sfcgal_geometry_t;
Minimal C API for SFCGAL sfcgal_geometry_t is an opaque pointer type that is used to represent a pointer to SFCGAL::Geometry
enum sfcgal_geometry_type_t
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_SOLID = 101,
SFCGAL_TYPE_MULTISOLID = 102
};
Geometric types
typedef sfcgal_prepared_geometry_t
typedef void sfcgal_prepared_geometry_t;
Opaque type that represents the C++ type SFCGAL::PreparedGeometry
typedef srid_t
typedef uint32_t srid_t;
Public Functions Documentation
function sfcgal_approx_convex_partition_2
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)
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_full_version
SFCGAL_API const char * sfcgal_full_version ()
Get full version (including CGAL and Boost versions)
function sfcgal_geometry_alpha_shapes
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
Precondition:
alpha >= 0
Postcondition:
isValid(return) == true
function sfcgal_geometry_approximate_medial_axis
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_approximate_medial_axis (
const sfcgal_geometry_t * geom
)
Returns the approximate medial axis for the given Polygon Approximate medial axis is based on straight skeleton
Precondition:
isValid(geom) == true
function sfcgal_geometry_area
SFCGAL_API double sfcgal_geometry_area (
const sfcgal_geometry_t * geom
)
Returns the area of geom
Precondition:
isValid(geom) == true
function sfcgal_geometry_area_3d
SFCGAL_API double sfcgal_geometry_area_3d (
const sfcgal_geometry_t * geom
)
Returns the 3D area of geom
Precondition:
isValid(geom) == true
function sfcgal_geometry_as_hexwkb
SFCGAL_API 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
SFCGAL_API 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
SFCGAL_API 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_text
SFCGAL_API 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
SFCGAL_API 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
SFCGAL_API void 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
SFCGAL_API void 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
SFCGAL_API 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_buffer3d
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:
geom
The input geometry (must be a Point or LineString)radius
The buffer radiussegments
The number of segments to use for approximating curved surfacesbuffer_type
The type of buffer to compute (ROUND, CYLSPHERE, or FLAT)
Returns:
A new geometry representing the 3D buffer
Precondition:
isValid(geom) == true
Precondition:
radius > 0
Precondition:
segments > 2
Postcondition:
isValid(return) == true
function sfcgal_geometry_clone
SFCGAL_API sfcgal_geometry_t * 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
SFCGAL_API 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
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_collection_create ()
Creates an empty GeometryCollection
Geometry collection
function sfcgal_geometry_collection_geometry_n
SFCGAL_API const sfcgal_geometry_t * 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
SFCGAL_API size_t sfcgal_geometry_collection_num_geometries (
const sfcgal_geometry_t * collection
)
Returns the number of geometries of a given GeometryCollection
Precondition:
collection is a GeometryCollection
function sfcgal_geometry_convexhull
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_convexhull (
const sfcgal_geometry_t * geom
)
Returns the convex hull of geom
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_convexhull_3d
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_convexhull_3d (
const sfcgal_geometry_t * geom
)
Returns the 3D convex hull of geom
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_covers
SFCGAL_API int sfcgal_geometry_covers (
const sfcgal_geometry_t * geom1,
const sfcgal_geometry_t * geom2
)
Tests the coverage of geom1 and geom2
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_covers_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_delete
SFCGAL_API 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_difference
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_difference_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_distance
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_distance_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_extrude
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
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_extrude_polygon_straight_skeleton
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 Polygon
Precondition:
geom must be a Polygon
Precondition:
isValid(geom) == true
Precondition:
roof_height != 0
function sfcgal_geometry_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 Polygon
Precondition:
geom must be a Polygon
Precondition:
isValid(geom) == true
Precondition:
height != 0
function sfcgal_geometry_force_lhr
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_force_lhr (
const sfcgal_geometry_t * geom
)
Force a Left Handed Rule on the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_force_rhr
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_force_rhr (
const sfcgal_geometry_t * geom
)
Force a Right Handed Rule on the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_force_valid
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
function sfcgal_geometry_has_validity_flag
SFCGAL_API int sfcgal_geometry_has_validity_flag (
const sfcgal_geometry_t * geom
)
Gets the validity flag of the geometry.
function sfcgal_geometry_intersection
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_intersection_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_intersects
SFCGAL_API int sfcgal_geometry_intersects (
const sfcgal_geometry_t * geom1,
const sfcgal_geometry_t * geom2
)
Tests the intersection of geom1 and geom2
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_intersects_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
function sfcgal_geometry_is_3d
SFCGAL_API int sfcgal_geometry_is_3d (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is 3D or not
function sfcgal_geometry_is_empty
SFCGAL_API int sfcgal_geometry_is_empty (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is empty or not
function sfcgal_geometry_is_measured
SFCGAL_API int 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_planar
SFCGAL_API int sfcgal_geometry_is_planar (
const sfcgal_geometry_t * geom
)
Tests if the given Geometry is planar
Precondition:
isValid(geom) == true
function sfcgal_geometry_is_valid
SFCGAL_API int sfcgal_geometry_is_valid (
const sfcgal_geometry_t * geom
)
Tests if the given geometry is valid or not
function sfcgal_geometry_is_valid_detail
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:
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_line_sub_string
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 LineString between fractional distances
Precondition:
isValid(geom) == true
Precondition:
geom is a Linestring
Precondition:
-1 <= start <= 1
Precondition:
-1 <= end <= 1
Postcondition:
isValid(return) == true
function sfcgal_geometry_make_solid
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_make_solid (
const sfcgal_geometry_t * geom
)
Convert a PolyhedralSurface to a Solid
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_minkowski_sum
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_minkowski_sum (
const sfcgal_geometry_t * geom1,
const sfcgal_geometry_t * geom2
)
Returns the minkowski sum geom1 + geom2
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_offset_polygon
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_offset_polygon (
const sfcgal_geometry_t * geom,
double radius
)
Returns the offset polygon of the given Geometry.
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_optimal_alpha_shapes
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
Precondition:
alpha >= 0
Precondition:
nb_components >= 0
Postcondition:
isValid(return) == true
function sfcgal_geometry_orientation
SFCGAL_API int sfcgal_geometry_orientation (
const sfcgal_geometry_t * geom
)
Returns the orientation of the given Polygon -1 for a counter clockwise orientation 1 for a clockwise orientation 0 for an invalid or undetermined orientation
Precondition:
geom is a Polygon
Precondition:
isValid(geom) == true
Get geometry orientation. Returns: -1 for a counter clock wise orientation, 1 for a clock wise orientation, 0 for invalid or undetermined orientation
function sfcgal_geometry_rotate
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate (
const sfcgal_geometry_t * geom,
double angle
)
Rotates a geometry around the origin (0,0,0) by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radians
Returns:
The rotated geometry
function sfcgal_geometry_rotate_2d
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_2d (
const sfcgal_geometry_t * geom,
double angle,
double cx,
double cy
)
Rotates a geometry around a specified point by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radianscx
X-coordinate of the center pointcy
Y-coordinate of the center point
Returns:
The rotated geometry
function sfcgal_geometry_rotate_3d
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_3d (
const sfcgal_geometry_t * geom,
double angle,
double ax,
double ay,
double az
)
Rotates a 3D geometry around a specified axis by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radiansax
X-coordinate of the axis vectoray
Y-coordinate of the axis vectoraz
Z-coordinate of the axis vector
Returns:
The rotated geometry
function sfcgal_geometry_rotate_3d_around_center
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 3D geometry around a specified axis and center point by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radiansax
X-coordinate of the axis vectoray
Y-coordinate of the axis vectoraz
Z-coordinate of the axis vectorcx
X-coordinate of the center pointcy
Y-coordinate of the center pointcz
Z-coordinate of the center point
Returns:
The rotated geometry
function sfcgal_geometry_rotate_x
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_x (
const sfcgal_geometry_t * geom,
double angle
)
Rotates a geometry around the X axis by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radians
Returns:
The rotated geometry
function sfcgal_geometry_rotate_y
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_y (
const sfcgal_geometry_t * geom,
double angle
)
Rotates a geometry around the Y axis by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radians
Returns:
The rotated geometry
function sfcgal_geometry_rotate_z
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_rotate_z (
const sfcgal_geometry_t * geom,
double angle
)
Rotates a geometry around the Z axis by a given angle
Parameters:
geom
The geometry to rotateangle
Rotation angle in radians
Returns:
The rotated geometry
function sfcgal_geometry_round
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_round (
const sfcgal_geometry_t * geom,
int r
)
Round coordinates of the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_scale
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_scale (
const sfcgal_geometry_t * geom,
double s
)
Scale a geometry by a given factor
Parameters:
geom
The geometry to scales
Scale factor
Returns:
The scaled geometry
function sfcgal_geometry_scale_3d
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:
geom
The geometry to scalesx
Scale factor for x dimensionsy
Scale factor for y dimensionsz
Scale factor for z dimension
Returns:
The scaled geometry
function sfcgal_geometry_scale_3d_around_center
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:
geom
The geometry to scalesx
Scale factor for x dimensionsy
Scale factor for y dimensionsz
Scale factor for z dimensioncx
X-coordinate of the center pointcy
Y-coordinate of the center pointcz
Z-coordinate of the center point
Returns:
The scaled geometry
function sfcgal_geometry_straight_skeleton
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_straight_skeleton (
const sfcgal_geometry_t * geom
)
Returns the straight skeleton of the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_straight_skeleton_distance_in_m
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
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_straight_skeleton_partition
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_straight_skeleton_partition (
const sfcgal_geometry_t * geom,
bool autoOrientation
)
Returns the straight skeleton partition for the given Polygon
Precondition:
isValid(geom) == true
Precondition:
geom must be a Polygon, Triangle or MultiPolygon
Postcondition:
isValid(return) == true
function sfcgal_geometry_tesselate
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_tesselate (
const sfcgal_geometry_t * geom
)
Returns a tesselation of the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_translate_2d
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_translate_2d (
sfcgal_geometry_t * geom,
double dx,
double dy
)
Translate a geometry by a 2D vector
Parameters:
geom
the geometry to translatedx
x component of the translation vectordy
y component of the translation vector
function sfcgal_geometry_translate_3d
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_translate_3d (
sfcgal_geometry_t * geom,
double dx,
double dy,
double dz
)
Translate a geometry by a 3D vector
Parameters:
geom
the geometry to translatedx
x component of the translation vectordy
y component of the translation vectordz
z component of the translation vector
function sfcgal_geometry_triangulate_2dz
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_triangulate_2dz (
const sfcgal_geometry_t * geom
)
Returns a triangulation of the given Geometry
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_type_id
SFCGAL_API sfcgal_geometry_type_t sfcgal_geometry_type_id (
const sfcgal_geometry_t * geom
)
Returns the type of a given geometry
function sfcgal_geometry_union
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_union_3d
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
Precondition:
isValid(geom1) == true
Precondition:
isValid(geom2) == true
Postcondition:
isValid(return) == true
function sfcgal_geometry_visibility_point
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 Point inside a Polygon
Parameters:
polygon
input geometrypoint
input geometry
Precondition:
polygon is a valid geometry
Precondition:
point must be inside polygon or on the boundary
function sfcgal_geometry_visibility_segment
build the visibility polygon of the segment [pointA ; pointB] on a Polygon
SFCGAL_API sfcgal_geometry_t * sfcgal_geometry_visibility_segment (
const sfcgal_geometry_t * polygon,
const sfcgal_geometry_t * pointA,
const sfcgal_geometry_t * pointB
)
Parameters:
polygon
input geometrypointA
input geometrypointB
input geometry
Precondition:
polygon is a valid geometry
Precondition:
pointA and pointB must be vertices of poly, adjacents and respect the direction
function sfcgal_geometry_volume
SFCGAL_API double sfcgal_geometry_volume (
const sfcgal_geometry_t * geom
)
Returns the volume of geom (must be a volume)
Precondition:
isValid(geom) == true
function sfcgal_greene_approx_convex_partition_2
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)
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_init
SFCGAL_API void sfcgal_init ()
This function must be called before all the other one.
function sfcgal_io_read_binary_prepared
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_io_read_binary_prepared (
const char * str,
size_t l
)
function sfcgal_io_read_ewkt
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_io_read_ewkt (
const char * str,
size_t len
)
function sfcgal_io_read_wkb
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_wkb (
const char * str,
size_t len
)
io::readWKB
function sfcgal_io_read_wkt
SFCGAL_API sfcgal_geometry_t * sfcgal_io_read_wkt (
const char * str,
size_t len
)
io::readWKT
function sfcgal_io_write_binary_prepared
SFCGAL_API void sfcgal_io_write_binary_prepared (
const sfcgal_prepared_geometry_t * geom,
char ** buffer,
size_t * len
)
Serialization
function sfcgal_linestring_add_point
SFCGAL_API 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
SFCGAL_API sfcgal_geometry_t * sfcgal_linestring_create ()
Creates an empty LineString
LineString
function sfcgal_linestring_num_points
SFCGAL_API size_t 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
SFCGAL_API const sfcgal_geometry_t * sfcgal_linestring_point_n (
const sfcgal_geometry_t * linestring,
size_t i
)
Returns the ith point of a given LineString
Parameters:
i
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
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_linestring_create ()
Creates an empty MultiLineString
function sfcgal_multi_point_create
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_point_create ()
Creates an empty MultiPoint
Multi-*
function sfcgal_multi_polygon_create
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_polygon_create ()
Creates an empty MultiPolygon
function sfcgal_multi_solid_create
SFCGAL_API sfcgal_geometry_t * sfcgal_multi_solid_create ()
Creates an empty MultiSolid
function sfcgal_optimal_convex_partition_2
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)
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
function sfcgal_point_create
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create ()
Creates an empty point
Point
function sfcgal_point_create_from_xy
SFCGAL_API sfcgal_geometry_t * sfcgal_point_create_from_xy (
double x,
double y
)
Creates a point from two X and Y coordinates
function sfcgal_point_create_from_xym
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
function sfcgal_point_create_from_xyz
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
function sfcgal_point_create_from_xyzm
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
function sfcgal_point_m
SFCGAL_API double 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
SFCGAL_API double 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
SFCGAL_API double 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
SFCGAL_API double 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
SFCGAL_API 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
function sfcgal_polygon_create
SFCGAL_API sfcgal_geometry_t * sfcgal_polygon_create ()
Creates an empty Polygon
Polygon
function sfcgal_polygon_create_from_exterior_ring
SFCGAL_API sfcgal_geometry_t * 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
SFCGAL_API const sfcgal_geometry_t * 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
SFCGAL_API const sfcgal_geometry_t * 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
SFCGAL_API size_t 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_polygon
SFCGAL_API 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
function sfcgal_polyhedral_surface_create
SFCGAL_API sfcgal_geometry_t * sfcgal_polyhedral_surface_create ()
Creates an empty PolyhedralSurface
Polyhedral surface
function sfcgal_polyhedral_surface_num_polygons
SFCGAL_API size_t 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
function sfcgal_polyhedral_surface_polygon_n
SFCGAL_API const sfcgal_geometry_t * 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_polygons(polyhedral)
Postcondition:
the returned Polygon is not writable and must not be deallocated by the caller
function sfcgal_prepared_geometry_as_ewkt
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 PreparedGeometry
Parameters:
num_decimals
number of decimals. -2 for a variable number of decimals. -1 for an exact representation
Postcondition:
buffer is returned allocated and must be freed by the caller
function sfcgal_prepared_geometry_create
SFCGAL_API sfcgal_prepared_geometry_t * sfcgal_prepared_geometry_create ()
Creates an empty PreparedGeometry
function sfcgal_prepared_geometry_create_from_geometry
SFCGAL_API sfcgal_prepared_geometry_t * 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
SFCGAL_API 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
SFCGAL_API const sfcgal_geometry_t * 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
SFCGAL_API 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
SFCGAL_API 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
SFCGAL_API srid_t 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
SFCGAL_API void sfcgal_set_alloc_handlers (
sfcgal_alloc_handler_t malloc_handler,
sfcgal_free_handler_t free_handler
)
Sets the error handlers. These callbacks are called on warning or error
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
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_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
SFCGAL_API void sfcgal_set_geometry_validation (
int enabled
)
Set the geometry validation mode
Note:
obsolete
function sfcgal_solid_add_interior_shell
SFCGAL_API 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
SFCGAL_API sfcgal_geometry_t * sfcgal_solid_create ()
Creates an empty Solid
Solid
function sfcgal_solid_create_from_exterior_shell
SFCGAL_API sfcgal_geometry_t * 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
SFCGAL_API size_t 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_shell_n
SFCGAL_API const sfcgal_geometry_t * 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
SFCGAL_API sfcgal_geometry_t * sfcgal_triangle_create ()
Creates an empty Triangle
Triangle
function sfcgal_triangle_create_from_points
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 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
SFCGAL_API 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
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_triangle_set_vertex_from_xy
SFCGAL_API 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
SFCGAL_API 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
SFCGAL_API const sfcgal_geometry_t * 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_triangle
SFCGAL_API 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
function sfcgal_triangulated_surface_create
SFCGAL_API sfcgal_geometry_t * sfcgal_triangulated_surface_create ()
Creates an empty TriangulatedSurface
Triangulated surface
function sfcgal_triangulated_surface_num_triangles
SFCGAL_API size_t 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
function sfcgal_triangulated_surface_triangle_n
SFCGAL_API const sfcgal_geometry_t * 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_triangles( tin )
Postcondition:
the returned Triangle is not writable and must not be deallocated by the caller
function sfcgal_version
SFCGAL_API const char * sfcgal_version ()
Get version
function sfcgal_y_monotone_partition_2
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)
Precondition:
isValid(geom) == true
Postcondition:
isValid(return) == true
The documentation for this class was generated from the following file /builds/sfcgal/SFCGAL/src/capi/sfcgal_c.h