PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ lwgeom_mindistance3d_tolerance()

double lwgeom_mindistance3d_tolerance ( const LWGEOM lw1,
const LWGEOM lw2,
double  tolerance 
)

Function handling 3d min distance calculations and dwithin calculations.

The difference is just the tolerance.

Definition at line 442 of file measures3d.c.

443 {
444  assert(tolerance >= 0);
445  if (!lwgeom_has_z(lw1) || !lwgeom_has_z(lw2))
446  {
447  lwnotice(
448  "One or both of the geometries is missing z-value. The unknown z-value will be regarded as \"any value\"");
449 
450  return lwgeom_mindistance2d_tolerance(lw1, lw2, tolerance);
451  }
452  DISTPTS3D thedl;
453  thedl.mode = DIST_MIN;
454  thedl.distance = DBL_MAX;
455  thedl.tolerance = tolerance;
456 
457  if (lw_dist3d_recursive(lw1, lw2, &thedl))
458  {
459  if (thedl.distance <= tolerance)
460  return thedl.distance;
462  return 0;
463 
464  return thedl.distance;
465  }
466 
467  /* should never get here. all cases ought to be error handled earlier */
468  lwerror("Some unspecified error.");
469  return DBL_MAX;
470 }
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:916
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
Definition: measures.c:207
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:190
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
Definition: lwutil.c:177
static int lwgeom_solid_contains_lwgeom(const LWGEOM *solid, const LWGEOM *g)
Definition: measures3d.c:348
int lw_dist3d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS3D *dl)
This is a recursive function delivering every possible combination of subgeometries.
Definition: measures3d.c:485
#define DIST_MIN
Definition: measures.h:44
double distance
Definition: measures3d.h:40
int mode
Definition: measures3d.h:43
double tolerance
Definition: measures3d.h:47
Structure used in distance-calculations.
Definition: measures3d.h:39

References DIST_MIN, DISTPTS3D::distance, lw_dist3d_recursive(), lwerror(), lwgeom_has_z(), lwgeom_mindistance2d_tolerance(), lwgeom_solid_contains_lwgeom(), lwnotice(), DISTPTS3D::mode, and DISTPTS3D::tolerance.

Referenced by LWGEOM_dwithin3d(), lwgeom_mindistance3d(), and ST_3DIntersects().

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