1101 TupleDesc resultTupleDesc;
1102 HeapTuple resultTuple;
1104 Datum result_values[2];
1105 bool result_is_null[2];
1108 if (PG_ARGISNULL(0))
1111 geom = PG_GETARG_GSERIALIZED_P(0);
1123 if (!(mbc && mbc->
center))
1125 lwpgerror(
"Error calculating minimum bounding circle.");
1140 get_call_result_type(fcinfo, NULL, &resultTupleDesc);
1141 BlessTupleDesc(resultTupleDesc);
1143 result_values[0] = PointerGetDatum(center);
1144 result_is_null[0] =
false;
1145 result_values[1] = Float8GetDatum(radius);
1146 result_is_null[1] =
false;
1148 resultTuple = heap_form_tuple(resultTupleDesc, result_values, result_is_null);
1150 result = HeapTupleGetDatum(resultTuple);
1152 PG_RETURN_DATUM(result);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
LWPOINT * lwpoint_make2d(int srid, double x, double y)
void lwgeom_free(LWGEOM *geom)
LWPOINT * lwpoint_construct_empty(int srid, char hasz, char hasm)
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
LWBOUNDINGCIRCLE * lwgeom_calculate_mbc(const LWGEOM *g)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
void lwboundingcircle_destroy(LWBOUNDINGCIRCLE *c)
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)...