PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum sfcgal_intersection ( PG_FUNCTION_ARGS  )

Definition at line 460 of file postgis/lwgeom_sfcgal.c.

References gserialized_get_srid(), POSTGIS2SFCGALGeometry(), sfcgal_postgis_init(), and SFCGALGeometry2POSTGIS().

461 {
462  GSERIALIZED *input0, *input1, *output;
463  sfcgal_geometry_t *geom0, *geom1;
464  sfcgal_geometry_t *result;
465  srid_t srid;
466 
468 
469  input0 = PG_GETARG_GSERIALIZED_P(0);
470  srid = gserialized_get_srid(input0);
471  input1 = PG_GETARG_GSERIALIZED_P(1);
472  geom0 = POSTGIS2SFCGALGeometry(input0);
473  PG_FREE_IF_COPY(input0, 0);
474  geom1 = POSTGIS2SFCGALGeometry(input1);
475  PG_FREE_IF_COPY(input1, 1);
476 
477  result = sfcgal_geometry_intersection(geom0, geom1);
478  sfcgal_geometry_delete(geom0);
479  sfcgal_geometry_delete(geom1);
480 
481  output = SFCGALGeometry2POSTGIS(result, 0, srid);
482  sfcgal_geometry_delete(result);
483 
484  PG_RETURN_POINTER(output);
485 }
sfcgal_geometry_t * POSTGIS2SFCGALGeometry(GSERIALIZED *pglwgeom)
GSERIALIZED * SFCGALGeometry2POSTGIS(const sfcgal_geometry_t *geom, int force3D, int SRID)
void sfcgal_postgis_init(void)
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
Definition: g_serialized.c:69

Here is the call graph for this function: