PostGIS  2.1.10dev-r@@SVN_REVISION@@
int lw_dist3d_poly_poly ( LWPOLY poly1,
LWPOLY poly2,

polygon to polygon calculation

Definition at line 480 of file measures3d.c.

References define_plane(), DIST_MAX, DISTPTS3D::distance, lw_dist3d_ptarray_poly(), lw_dist3d_ptarray_ptarray(), LW_FALSE, LW_TRUE, LWDEBUG, DISTPTS3D::mode, LWPOLY::rings, and DISTPTS3D::twisted.

Referenced by lw_dist3d_distribute_bruteforce().

481 {
482  PLANE3D plane;
483  LWDEBUG(2, "lw_dist3d_poly_poly is called");
484  if (dl->mode == DIST_MAX)
485  {
486  return lw_dist3d_ptarray_ptarray(poly1->rings[0], poly2->rings[0], dl);
487  }
489  if(!define_plane(poly2->rings[0], &plane))
490  return LW_FALSE;
492  /*What we do here is to compare the bondary of one polygon with the other polygon
493  and then take the second boudary comparing with the first polygon*/
494  dl->twisted=1;
495  if(!lw_dist3d_ptarray_poly(poly1->rings[0], poly2,&plane, dl))
496  return LW_FALSE;
497  if(dl->distance==0.0) /*Just check if the answer already is given*/
498  return LW_TRUE;
500  if(!define_plane(poly1->rings[0], &plane))
501  return LW_FALSE;
502  dl->twisted=-1; /*because we swithc the order of geometries we swithch "twisted" to -1 which will give the right order of points in shortest line.*/
503  return lw_dist3d_ptarray_poly(poly2->rings[0], poly1,&plane, dl);
504 }
double distance
Definition: measures3d.h:26
#define DIST_MAX
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
int twisted
Definition: measures3d.h:30
Definition: liblwgeom.h:413
int mode
Definition: measures3d.h:29
int define_plane(POINTARRAY *pa, PLANE3D *pl)
Here we define the plane of a polygon (boundary pointarray of a polygon) the plane is stored as a pon...
Definition: measures3d.c:923
int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinationes of segments between two pointarrays.
Definition: measures3d.c:630
int lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
Computes pointarray to polygon distance.
Definition: measures3d.c:840

Here is the call graph for this function:

Here is the caller graph for this function: