PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM* lw_dist3d_distancepoint ( LWGEOM lw1,
int  srid,
int  mode 

Function initializing 3dclosestpoint calculations.

Definition at line 79 of file measures3d.c.

References COLLECTIONTYPE, DISTPTS3D::distance, lw_dist3d_recursive(), lwcollection_construct_empty(), LWDEBUG, lwerror(), lwpoint_make3dz(), MAXFLOAT, DISTPTS3D::mode, DISTPTS3D::p1, result, DISTPTS3D::tolerance, pixval::x, POINT3DZ::x, pixval::y, POINT3DZ::y, and POINT3DZ::z.

Referenced by LWGEOM_closestpoint3d().

80 {
81  double x,y,z;
82  DISTPTS3D thedl;
83  double initdistance = MAXFLOAT;
84  LWGEOM *result;
86  thedl.mode = mode;
87  thedl.distance= initdistance;
88  thedl.tolerance = 0;
90  LWDEBUG(2, "lw_dist3d_distancepoint is called");
92  if (!lw_dist3d_recursive(lw1, lw2, &thedl))
93  {
94  /*should never get here. all cases ought to be error handled earlier*/
95  lwerror("Some unspecified error.");
96  result = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, srid, 0, 0);
97  }
99  if (thedl.distance == initdistance)
100  {
101  LWDEBUG(3, "didn't find geometries to measure between, returning null");
102  result = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, srid, 0, 0);
103  }
104  else
105  {
106  x=thedl.p1.x;
107  y=thedl.p1.y;
108  z=thedl.p1.z;
109  result = (LWGEOM *)lwpoint_make3dz(srid, x, y, z);
110  }
112  return result;
113 }
double z
Definition: liblwgeom.h:290
double y
Definition: liblwgeom.h:290
double distance
Definition: measures3d.h:26
double x
Definition: liblwgeom.h:290
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
Structure used in distance-calculations.
Definition: measures3d.h:24
char ** result
Definition: liblwgeom.h:218
Definition: measures3d.h:27
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
LWPOINT * lwpoint_make3dz(int srid, double x, double y, double z)
Definition: lwpoint.c:140
int mode
Definition: measures3d.h:29
tuple x
int lw_dist3d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS3D *dl)
This is a recursive function delivering every possible combinatin of subgeometries.
Definition: measures3d.c:194
double tolerance
Definition: measures3d.h:31
#define MAXFLOAT
Largest float value.
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
tuple y
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: