PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lw_dist3d_poly_poly()

int lw_dist3d_poly_poly ( LWPOLY poly1,
LWPOLY poly2,

polygon to polygon calculation

Definition at line 661 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().

662 {
663  PLANE3D plane;
664  LWDEBUG(2, "lw_dist3d_poly_poly is called");
665  if (dl->mode == DIST_MAX)
666  {
667  return lw_dist3d_ptarray_ptarray(poly1->rings[0], poly2->rings[0], dl);
668  }
670  if(!define_plane(poly2->rings[0], &plane))
671  return LW_FALSE;
673  /*What we do here is to compare the bondary of one polygon with the other polygon
674  and then take the second boudary comparing with the first polygon*/
675  dl->twisted=1;
676  if(!lw_dist3d_ptarray_poly(poly1->rings[0], poly2,&plane, dl))
677  return LW_FALSE;
678  if(dl->distance==0.0) /*Just check if the answer already is given*/
679  return LW_TRUE;
681  if(!define_plane(poly1->rings[0], &plane))
682  return LW_FALSE;
683  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.*/
684  return lw_dist3d_ptarray_poly(poly2->rings[0], poly1,&plane, dl);
685 }
double distance
Definition: measures3d.h:27
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
int twisted
Definition: measures3d.h:31
Definition: liblwgeom.h:441
int mode
Definition: measures3d.h:30
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:1113
#define DIST_MAX
Definition: measures.h:16
int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinationes of segments between two pointarrays.
Definition: measures3d.c:820
int lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
Computes pointarray to polygon distance.
Definition: measures3d.c:1030
Here is the call graph for this function:
Here is the caller graph for this function: