PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ box2df_penalty()

static float box2df_penalty ( const BOX2DF *  b1,
const BOX2DF *  b2 
)
inlinestatic

Definition at line 1199 of file gserialized_gist_2d.c.

1200 {
1201  float b1xmin = b1->xmin, b1xmax = b1->xmax;
1202  float b1ymin = b1->ymin, b1ymax = b1->ymax;
1203  float b2xmin = b2->xmin, b2xmax = b2->xmax;
1204  float b2ymin = b2->ymin, b2ymax = b2->ymax;
1205 
1206  float box_union_xmin = Min(b1xmin, b2xmin), box_union_xmax = Max(b1xmax, b2xmax);
1207  float box_union_ymin = Min(b1ymin, b2ymin), box_union_ymax = Max(b1ymax, b2ymax);
1208 
1209  float b1dx = b1xmax - b1xmin, b1dy = b1ymax - b1ymin;
1210  float box_union_dx = box_union_xmax - box_union_xmin, box_union_dy = box_union_ymax - box_union_ymin;
1211 
1212  float box_union_area = box_union_dx * box_union_dy, box1area = b1dx * b1dy;
1213  float box_union_edge = box_union_dx + box_union_dy, box1edge = b1dx + b1dy;
1214 
1215  float area_extension = box_union_area - box1area;
1216  float edge_extension = box_union_edge - box1edge;
1217 
1218  /* REALM 1: Area extension is nonzero, return it */
1219  if (area_extension > FLT_EPSILON)
1220  return pack_float(area_extension, 1);
1221  /* REALM 0: Area extension is zero, return nonzero edge extension */
1222  else if (edge_extension > FLT_EPSILON)
1223  return pack_float(edge_extension, 0);
1224 
1225  return 0;
1226 }
static float pack_float(const float value, const uint8_t realm)

References pack_float().

Referenced by gserialized_gist_penalty_2d(), and gserialized_gist_picksplit_2d().

Here is the call graph for this function:
Here is the caller graph for this function: