PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ box2df_penalty()

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

Definition at line 1152 of file gserialized_gist_2d.c.

1153 {
1154  float b1xmin = b1->xmin, b1xmax = b1->xmax;
1155  float b1ymin = b1->ymin, b1ymax = b1->ymax;
1156  float b2xmin = b2->xmin, b2xmax = b2->xmax;
1157  float b2ymin = b2->ymin, b2ymax = b2->ymax;
1158 
1159  float box_union_xmin = Min(b1xmin, b2xmin), box_union_xmax = Max(b1xmax, b2xmax);
1160  float box_union_ymin = Min(b1ymin, b2ymin), box_union_ymax = Max(b1ymax, b2ymax);
1161 
1162  float b1dx = b1xmax - b1xmin, b1dy = b1ymax - b1ymin;
1163  float box_union_dx = box_union_xmax - box_union_xmin, box_union_dy = box_union_ymax - box_union_ymin;
1164 
1165  float box_union_area = box_union_dx * box_union_dy, box1area = b1dx * b1dy;
1166  float box_union_edge = box_union_dx + box_union_dy, box1edge = b1dx + b1dy;
1167 
1168  float area_extension = box_union_area - box1area;
1169  float edge_extension = box_union_edge - box1edge;
1170 
1171  /* REALM 1: Area extension is nonzero, return it */
1172  if (area_extension > FLT_EPSILON)
1173  return pack_float(area_extension, 1);
1174  /* REALM 0: Area extension is zero, return nonzero edge extension */
1175  else if (edge_extension > FLT_EPSILON)
1176  return pack_float(edge_extension, 0);
1177 
1178  return 0;
1179 }
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: