Datum point_inside_circle(PG_FUNCTION_ARGS);
Datum distance(PG_FUNCTION_ARGS);
+Datum expand_bbox(PG_FUNCTION_ARGS);
//for GIST index
typedef char* (*BINARY_UNION)(char*, char*, int*);
AS '@MODULE_FILENAME@','get_geometry_of_bbox'
LANGUAGE 'c' WITH (iscachable,isstrict);
+CREATE FUNCTION expand(BOX3D,float8)
+ RETURNS BOX3D
+ AS '@MODULE_FILENAME@','expand_bbox'
+ LANGUAGE 'c' WITH (iscachable,isstrict);
+
+
--------- functions for converting to wkb
CREATE FUNCTION asbinary(GEOMETRY)
if (dist <0)
dist = 0; //computational error, may get -0.00000000001
PG_RETURN_FLOAT8(dist);
-}
\ No newline at end of file
+}
+
+
+//expand_bbox(bbox3d, d)
+// returns a new bbox which is exanded d unit in all directions
+PG_FUNCTION_INFO_V1(expand_bbox);
+Datum expand_bbox(PG_FUNCTION_ARGS)
+{
+ BOX3D *bbox = (BOX3D *) PG_GETARG_POINTER(0);
+ double d = PG_GETARG_FLOAT8(1);
+ BOX3D *result = (BOX3D *) palloc(sizeof(BOX3D));
+
+
+ result->LLB.x = bbox->LLB.x - d;
+ result->LLB.y = bbox->LLB.y - d;
+ result->LLB.z = bbox->LLB.z - d;
+
+
+ result->URT.x = bbox->URT.x + d;
+ result->URT.y = bbox->URT.y + d;
+ result->URT.z = bbox->URT.z + d;
+
+
+ PG_RETURN_POINTER(result);
+}
+
+