SFCGAL  1.3.0
Typedefs | Enumerations | Functions
Public C API

Typedefs

typedef void sfcgal_geometry_t
 SFCGAL. More...
 
typedef void sfcgal_prepared_geometry_t
 Opaque type that represents the C++ type SFCGAL::PreparedGeometry. 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 = 100, SFCGAL_TYPE_SOLID = 101, SFCGAL_TYPE_MULTISOLID = 102
}
 Geometric types. 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 *)
 Returns the type of a given geometry. More...
 
SFCGAL_API int sfcgal_geometry_is_valid (const sfcgal_geometry_t *)
 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_3d (const sfcgal_geometry_t *)
 Tests if the given geometry is 3D or not. More...
 
SFCGAL_API int sfcgal_geometry_is_empty (const sfcgal_geometry_t *)
 Tests if the given geometry is empty or not. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_clone (const sfcgal_geometry_t *)
 Returns a deep clone of the given geometry. More...
 
SFCGAL_API void sfcgal_geometry_delete (sfcgal_geometry_t *)
 Deletes a given geometry. More...
 
SFCGAL_API void sfcgal_geometry_as_text (const sfcgal_geometry_t *, 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 *, int numDecimals, char **buffer, size_t *len)
 Returns a WKT representation of the given geometry using floating point coordinate values. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_point_create ()
 Creates an empty point. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_point_create_from_xy (double x, double y)
 Creates a point from two X and Y coordinates. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_point_create_from_xyz (double x, double y, double z)
 Creates a point from three X, Y and Z coordinates. More...
 
SFCGAL_API double sfcgal_point_x (const sfcgal_geometry_t *)
 Returns the X coordinate of the given Point. More...
 
SFCGAL_API double sfcgal_point_y (const sfcgal_geometry_t *)
 Returns the Y coordinate of the given Point. More...
 
SFCGAL_API double sfcgal_point_z (const sfcgal_geometry_t *)
 Returns the Z coordinate of the given Point. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_linestring_create ()
 Creates an empty LineString. More...
 
SFCGAL_API size_t sfcgal_linestring_num_points (const sfcgal_geometry_t *linestring)
 Returns the number of points of the given LineString. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_linestring_point_n (const sfcgal_geometry_t *linestring, size_t i)
 Returns the ith point of a given LineString. More...
 
SFCGAL_API void sfcgal_linestring_add_point (sfcgal_geometry_t *linestring, sfcgal_geometry_t *point)
 Adds a point to a LineString. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_triangle_create ()
 Creates an empty Triangle. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_triangle_vertex (const sfcgal_geometry_t *triangle, int i)
 Returns one the Triangle's vertex as a Point. More...
 
SFCGAL_API void sfcgal_triangle_set_vertex (sfcgal_geometry_t *triangle, int i, const sfcgal_geometry_t *vertex)
 Sets one vertex of a Triangle. More...
 
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. More...
 
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. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_polygon_create ()
 Creates an empty Polygon. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_polygon_create_from_exterior_ring (sfcgal_geometry_t *ring)
 Creates an empty Polygon from an extrior ring. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_polygon_exterior_ring (const sfcgal_geometry_t *polygon)
 Returns the exterior ring of a given 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 Polygon. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_polygon_interior_ring_n (const sfcgal_geometry_t *polygon, size_t i)
 Returns the ith interior ring of a given 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 Polygon. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_collection_create ()
 Creates an empty GeometryCollection. More...
 
SFCGAL_API size_t sfcgal_geometry_collection_num_geometries (const sfcgal_geometry_t *collection)
 Returns the number of geometries of a given GeometryCollection. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_geometry_collection_geometry_n (const sfcgal_geometry_t *collection, size_t i)
 Returns the ith geometry of a GeometryCollection. More...
 
SFCGAL_API void sfcgal_geometry_collection_add_geometry (sfcgal_geometry_t *collection, sfcgal_geometry_t *geometry)
 Adds a Geometry to a given GeometryCollection. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_multi_point_create ()
 Creates an empty MultiPoint. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_multi_linestring_create ()
 Creates an empty MultiLineString. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_multi_polygon_create ()
 Creates an empty MultiPolygon. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_polyhedral_surface_create ()
 Creates an empty PolyhedralSurface. More...
 
SFCGAL_API size_t sfcgal_polyhedral_surface_num_polygons (const sfcgal_geometry_t *polyhedral)
 Returns the number of polygons of a given PolyhedralSurface. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_polyhedral_surface_polygon_n (const sfcgal_geometry_t *polyhedral, size_t i)
 Returns the ith polygon of a given PolyhedralSurface. More...
 
SFCGAL_API void sfcgal_polyhedral_surface_add_polygon (sfcgal_geometry_t *polyhedral, sfcgal_geometry_t *polygon)
 Adds a Polygon to a given PolyhedralSurface. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_triangulated_surface_create ()
 Creates an empty TriangulatedSurface. More...
 
SFCGAL_API size_t sfcgal_triangulated_surface_num_triangles (const sfcgal_geometry_t *tin)
 Returns the number of triangles of a given TriangulatedSurface. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_triangulated_surface_triangle_n (const sfcgal_geometry_t *tin, size_t i)
 Returns the ith Triangle of a given TriangulatedSurface. More...
 
SFCGAL_API void sfcgal_triangulated_surface_add_triangle (sfcgal_geometry_t *tin, sfcgal_geometry_t *triangle)
 Adds a Triangle to a given TriangulatedSurface. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_solid_create ()
 Creates an empty Solid. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_solid_create_from_exterior_shell (sfcgal_geometry_t *shell)
 Creates a 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 Solid. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_solid_shell_n (const sfcgal_geometry_t *solid, size_t i)
 Returns the ith shell of a given Solid. More...
 
SFCGAL_API void sfcgal_solid_add_shell (sfcgal_geometry_t *solid, sfcgal_geometry_t *shell)
 Adds a shell to a given Solid. More...
 
SFCGAL_API sfcgal_prepared_geometry_tsfcgal_prepared_geometry_create ()
 Creates an empty PreparedGeometry. More...
 
SFCGAL_API sfcgal_prepared_geometry_tsfcgal_prepared_geometry_create_from_geometry (sfcgal_geometry_t *geometry, srid_t srid)
 Creates a PreparedGeometry from a Geometry and an SRID. More...
 
SFCGAL_API void sfcgal_prepared_geometry_delete (sfcgal_prepared_geometry_t *prepared)
 Deletes a given PreparedGeometry. More...
 
SFCGAL_API const sfcgal_geometry_tsfcgal_prepared_geometry_geometry (const sfcgal_prepared_geometry_t *prepared)
 Returns the Geometry associated with a given 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 PreparedGeometry. More...
 
SFCGAL_API srid_t sfcgal_prepared_geometry_srid (const sfcgal_prepared_geometry_t *prepared)
 Returns SRID associated with a given PreparedGeometry. More...
 
SFCGAL_API void sfcgal_prepared_geometry_set_srid (sfcgal_prepared_geometry_t *prepared, srid_t)
 Sets SRID associated with a given 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 PreparedGeometry. 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_tsfcgal_geometry_intersection (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the intersection of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_geometry_difference (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the difference of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_geometry_union (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the union of geom1 and geom2. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_geometry_convexhull (const sfcgal_geometry_t *geom)
 Returns the convex hull of geom. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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 Polygon -1 for a counter clockwise orientation 1 for a clockwise orientation 0 for an invalid or undetermined orientation. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_tesselate (const sfcgal_geometry_t *geom)
 Returns a tesselation of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_triangulate_2dz (const sfcgal_geometry_t *geom)
 Returns a triangulation of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_geometry_force_lhr (const sfcgal_geometry_t *geom)
 Force a Left Handed Rule on the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_geometry_round (const sfcgal_geometry_t *geom, int r)
 Round coordinates of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_minkowski_sum (const sfcgal_geometry_t *geom1, const sfcgal_geometry_t *geom2)
 Returns the minkowski sum geom1 + geom2. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_offset_polygon (const sfcgal_geometry_t *geom, double radius)
 Returns the offset polygon of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_geometry_straight_skeleton (const sfcgal_geometry_t *geom)
 Returns the straight skeleton of the given Geometry. More...
 
SFCGAL_API sfcgal_geometry_tsfcgal_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_tsfcgal_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. 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 malloc_handler, sfcgal_free_handler_t free_handler)
 Sets the error handlers. More...
 
SFCGAL_API void sfcgal_init ()
 This function must be called before all the other one. More...
 
SFCGAL_API const char * sfcgal_version ()
 Get version. More...
 

Detailed Description

Typedef Documentation

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

Warning and error handlers.

typedef void sfcgal_geometry_t

SFCGAL.

Copyright (C) 2012-2013 Oslandia infos.nosp@m.@osl.nosp@m.andia.nosp@m..com Copyright (C) 2012-2013 IGN (http://www.ign.fr)

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, see http://www.gnu.org/licenses/.

Minimal C API for SFCGAL 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.

Enumeration Type Documentation

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_SOLID 
SFCGAL_TYPE_MULTISOLID 

Function Documentation

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
SFCGAL_API double sfcgal_geometry_area ( const sfcgal_geometry_t geom)

Returns the area of geom.

Precondition
isValid(geom) == true
SFCGAL_API double sfcgal_geometry_area_3d ( const sfcgal_geometry_t geom)

Returns the 3D area of geom.

Precondition
isValid(geom) == true
SFCGAL_API void sfcgal_geometry_as_text ( const sfcgal_geometry_t ,
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
SFCGAL_API void sfcgal_geometry_as_text_decim ( const sfcgal_geometry_t ,
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
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_clone ( const sfcgal_geometry_t )

Returns a deep clone of the given geometry.

Postcondition
returns a pointer to an allocated geometry that must be deallocated by sfcgal_geometry_delete
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
SFCGAL_API sfcgal_geometry_t* sfcgal_geometry_collection_create ( )

Creates an empty GeometryCollection.

Creates an empty GeometryCollection.

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
i >= 0 and i < sfcgal_geometry_collection_num_geometries
Postcondition
the returned Geometry is not writable and must not be deallocated by the caller
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
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
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
SFCGAL_API void sfcgal_geometry_delete ( sfcgal_geometry_t )

Deletes a given 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.

Precondition
isValid(geom1) == true
isValid(geom2) == true
Postcondition
isValid(return) == true
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
isValid(geom2) == true
Postcondition
isValid(return) == true
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
isValid(geom2) == true
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
isValid(geom2) == true
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
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
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
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
isValid(geom2) == true
Postcondition
isValid(return) == true
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
isValid(geom2) == true
Postcondition
isValid(return) == true
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
isValid(geom2) == true
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
isValid(geom2) == true
SFCGAL_API int sfcgal_geometry_is_3d ( const sfcgal_geometry_t )

Tests if the given geometry is 3D or not.

SFCGAL_API int sfcgal_geometry_is_empty ( const sfcgal_geometry_t )

Tests if the given geometry is empty or not.

SFCGAL_API int sfcgal_geometry_is_planar ( const sfcgal_geometry_t geom)

Tests if the given Geometry is planar.

Precondition
isValid(geom) == true
SFCGAL_API int sfcgal_geometry_is_valid ( const sfcgal_geometry_t )

Tests if the given geometry is valid or not.

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
geomthe input geometry
invalidity_reasoninput/output parameter. If non null, a null-terminated string could be allocated and contain reason of the invalidity
invalidity_locationinput/output parameter. If non null, a geometry could be allocated and contain the location of the invalidity
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
isValid(geom2) == true
Postcondition
isValid(return) == true
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
SFCGAL_API int sfcgal_geometry_orientation ( const sfcgal_geometry_t ga)

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
isValid(geom) == true

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.

Returns: -1 for a counter clock wise orientation, 1 for a clock wise orientation, 0 for invalid or undetermined orientation

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
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
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
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
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
SFCGAL_API sfcgal_geometry_type_t sfcgal_geometry_type_id ( const sfcgal_geometry_t )

Returns the type of a given geometry.

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
isValid(geom2) == true
Postcondition
isValid(return) == true
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
isValid(geom2) == true
Postcondition
isValid(return) == true
SFCGAL_API double sfcgal_geometry_volume ( const sfcgal_geometry_t geom)

Returns the volume of geom (must be a volume)

Precondition
isValid(geom) == true
SFCGAL_API void sfcgal_init ( )

This function must be called before all the other one.

SFCGAL_API void sfcgal_linestring_add_point ( sfcgal_geometry_t linestring,
sfcgal_geometry_t point 
)

Adds a point to a LineString.

Parameters
linestringis the LineString where the Point has to be added to
pointis 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
SFCGAL_API sfcgal_geometry_t* sfcgal_linestring_create ( )

Creates an empty LineString.

Creates an empty LineString.

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
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
iis the point index in the LineString
Precondition
linestring must be a LineString
i >= and i < sfcgal_linestring_num_points
Postcondition
the returned Point is not writable and must not be deallocated by the caller
SFCGAL_API sfcgal_geometry_t* sfcgal_multi_linestring_create ( )

Creates an empty MultiLineString.

SFCGAL_API sfcgal_geometry_t* sfcgal_multi_point_create ( )

Creates an empty MultiPoint.

Creates an empty MultiPoint.

SFCGAL_API sfcgal_geometry_t* sfcgal_multi_polygon_create ( )

Creates an empty MultiPolygon.

SFCGAL_API sfcgal_geometry_t* sfcgal_point_create ( )

Creates an empty 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.

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.

SFCGAL_API double sfcgal_point_x ( const sfcgal_geometry_t )

Returns the X coordinate of the given Point.

Precondition
the given geometry must be a Point
the given point must not be empty
SFCGAL_API double sfcgal_point_y ( const sfcgal_geometry_t )

Returns the Y coordinate of the given Point.

Precondition
the given geometry must be a Point
the given point must not be empty
SFCGAL_API double sfcgal_point_z ( const sfcgal_geometry_t )

Returns the Z coordinate of the given Point.

Precondition
the given geometry must be a Point
the given point must not be empty
Postcondition
the Z coordinate can value NaN if the given point is 2D only
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
ring must be a LineString
SFCGAL_API sfcgal_geometry_t* sfcgal_polygon_create ( )

Creates an empty Polygon.

Creates an empty Polygon.

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
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
polygon must not be empty
Postcondition
the returned ring is a LineString, is not writable and must not be deallocated by the caller
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
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
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
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
polygon must be a Polygon
Postcondition
the ownership of the Polygon is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API sfcgal_geometry_t* sfcgal_polyhedral_surface_create ( )

Creates an empty PolyhedralSurface.

Creates an empty PolyhedralSurface.

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
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
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
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_decimalsnumber 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
SFCGAL_API sfcgal_prepared_geometry_t* sfcgal_prepared_geometry_create ( )

Creates an empty PreparedGeometry.

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.

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
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
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
SFCGAL_API void sfcgal_prepared_geometry_set_srid ( sfcgal_prepared_geometry_t prepared,
srid_t   
)

Sets SRID associated with a given PreparedGeometry.

Precondition
prepared must be a PreparedGeometry
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
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_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.

Note
obsolete
SFCGAL_API void sfcgal_solid_add_shell ( sfcgal_geometry_t solid,
sfcgal_geometry_t shell 
)

Adds a shell to a given Solid.

Precondition
solid must be a Solid
shell must be a 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 ( )

Creates an empty Solid.

Creates an empty Solid.

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
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
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
i >= 0 and i < sfcgal_solid_num_shells( tin )
Postcondition
the returned PolyhedralSurface is not writable and must not be deallocated by the caller
SFCGAL_API sfcgal_geometry_t* sfcgal_triangle_create ( )

Creates an empty Triangle.

Creates an empty 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 Triangle from three given Point.

Precondition
pta must be a Triangle
ptb must be a Triangle
ptc must be a Triangle
Postcondition
the ownership of the three points are not taken. The caller is still responsible of their deallocation
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
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
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
i >= 0 and i < 3
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
i >= 0 and i < 3
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
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
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
triangle must be a Triangle
Postcondition
the ownership of the Triangle is taken. The caller is not responsible anymore of its deallocation
SFCGAL_API sfcgal_geometry_t* sfcgal_triangulated_surface_create ( )

Creates an empty TriangulatedSurface.

Creates an empty TriangulatedSurface.

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
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
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
SFCGAL_API const char* sfcgal_version ( )

Get version.