PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ sfcgal_difference()

Datum sfcgal_difference ( PG_FUNCTION_ARGS  )

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

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

Referenced by sfcgal_intersection3D().

529 {
530  GSERIALIZED *input0, *input1, *output;
531  sfcgal_geometry_t *geom0, *geom1;
532  sfcgal_geometry_t *result;
533  srid_t srid;
534 
536 
537  input0 = (GSERIALIZED*) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
538  srid = gserialized_get_srid(input0);
539  input1 = (GSERIALIZED*) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
540  geom0 = POSTGIS2SFCGALGeometry(input0);
541  PG_FREE_IF_COPY(input0, 0);
542  geom1 = POSTGIS2SFCGALGeometry(input1);
543  PG_FREE_IF_COPY(input1, 1);
544 
545  result = sfcgal_geometry_difference(geom0, geom1);
546  sfcgal_geometry_delete(geom0);
547  sfcgal_geometry_delete(geom1);
548 
549  output = SFCGALGeometry2POSTGIS(result, 0, srid);
550  sfcgal_geometry_delete(result);
551 
552  PG_RETURN_POINTER(output);
553 }
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:100
Here is the call graph for this function:
Here is the caller graph for this function: