PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ box2df_penalty()

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

Definition at line 1234 of file gserialized_gist_2d.c.

1235 {
1236  float b1xmin = b1->xmin, b1xmax = b1->xmax;
1237  float b1ymin = b1->ymin, b1ymax = b1->ymax;
1238  float b2xmin = b2->xmin, b2xmax = b2->xmax;
1239  float b2ymin = b2->ymin, b2ymax = b2->ymax;
1240 
1241  float box_union_xmin = Min(b1xmin, b2xmin), box_union_xmax = Max(b1xmax, b2xmax);
1242  float box_union_ymin = Min(b1ymin, b2ymin), box_union_ymax = Max(b1ymax, b2ymax);
1243 
1244  float b1dx = b1xmax - b1xmin, b1dy = b1ymax - b1ymin;
1245  float box_union_dx = box_union_xmax - box_union_xmin, box_union_dy = box_union_ymax - box_union_ymin;
1246 
1247  float box_union_area = box_union_dx * box_union_dy, box1area = b1dx * b1dy;
1248  float box_union_edge = box_union_dx + box_union_dy, box1edge = b1dx + b1dy;
1249 
1250  float area_extension = box_union_area - box1area;
1251  float edge_extension = box_union_edge - box1edge;
1252 
1253  /* REALM 1: Area extension is nonzero, return it */
1254  if (area_extension > FLT_EPSILON)
1255  return pack_float(area_extension, 1);
1256  /* REALM 0: Area extension is zero, return nonzero edge extension */
1257  else if (edge_extension > FLT_EPSILON)
1258  return pack_float(edge_extension, 0);
1259 
1260  return 0;
1261 }
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: