PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ gidx_distance_m()

static double gidx_distance_m ( const GIDX *  a,
const GIDX *  b 
)
static

Definition at line 740 of file gserialized_gist_nd.c.

Referenced by gserialized_distance_nd().

741 {
742  int mdim_a, mdim_b;
743  double d, amin, amax, bmin, bmax;
744 
745  /* Base computation on least available dimensions */
746  mdim_a = GIDX_NDIMS(a) - 1;
747  mdim_b = GIDX_NDIMS(b) - 1;
748 
749  amin = GIDX_GET_MIN(a,mdim_a);
750  amax = GIDX_GET_MAX(a,mdim_a);
751  bmin = GIDX_GET_MIN(b,mdim_b);
752  bmax = GIDX_GET_MAX(b,mdim_b);
753 
754  if ( ( amin <= bmax && amax >= bmin ) )
755  {
756  /* overlaps */
757  d = 0;
758  }
759  else if ( bmax < amin )
760  {
761  /* is "left" */
762  d = amin - bmax;
763  }
764  else
765  {
766  /* is "right" */
767  assert( bmin > amax );
768  d = bmin - amax;
769  }
770 
771  return d;
772 }
Here is the caller graph for this function: