PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ box2df_penalty()

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

Definition at line 1215 of file gserialized_gist_2d.c.

1216 {
1217  float b1xmin = b1->xmin, b1xmax = b1->xmax;
1218  float b1ymin = b1->ymin, b1ymax = b1->ymax;
1219  float b2xmin = b2->xmin, b2xmax = b2->xmax;
1220  float b2ymin = b2->ymin, b2ymax = b2->ymax;
1221 
1222  float box_union_xmin = Min(b1xmin, b2xmin), box_union_xmax = Max(b1xmax, b2xmax);
1223  float box_union_ymin = Min(b1ymin, b2ymin), box_union_ymax = Max(b1ymax, b2ymax);
1224 
1225  float b1dx = b1xmax - b1xmin, b1dy = b1ymax - b1ymin;
1226  float box_union_dx = box_union_xmax - box_union_xmin, box_union_dy = box_union_ymax - box_union_ymin;
1227 
1228  float box_union_area = box_union_dx * box_union_dy, box1area = b1dx * b1dy;
1229  float box_union_edge = box_union_dx + box_union_dy, box1edge = b1dx + b1dy;
1230 
1231  float area_extension = box_union_area - box1area;
1232  float edge_extension = box_union_edge - box1edge;
1233 
1234  /* REALM 1: Area extension is nonzero, return it */
1235  if (area_extension > FLT_EPSILON)
1236  return pack_float(area_extension, 1);
1237  /* REALM 0: Area extension is zero, return nonzero edge extension */
1238  else if (edge_extension > FLT_EPSILON)
1239  return pack_float(edge_extension, 0);
1240 
1241  return 0;
1242 }
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: