PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ lw_dist3d_poly_poly()

int lw_dist3d_poly_poly ( LWPOLY poly1,
LWPOLY poly2,

polygon to polygon calculation

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

683 {
684  PLANE3D plane;
685  LWDEBUG(2, "lw_dist3d_poly_poly is called");
686  if (dl->mode == DIST_MAX)
687  {
688  return lw_dist3d_ptarray_ptarray(poly1->rings[0], poly2->rings[0], dl);
689  }
691  if(!define_plane(poly2->rings[0], &plane))
692  return LW_FALSE;
694  /*What we do here is to compare the boundary of one polygon with the other polygon
695  and then take the second boundary comparing with the first polygon*/
696  dl->twisted=1;
697  if(!lw_dist3d_ptarray_poly(poly1->rings[0], poly2,&plane, dl))
698  return LW_FALSE;
699  if(dl->distance==0.0) /*Just check if the answer already is given*/
700  return LW_TRUE;
702  if(!define_plane(poly1->rings[0], &plane))
703  return LW_FALSE;
704  dl->twisted=-1; /*because we switch the order of geometries we switch "twisted" to -1 which will give the right order of points in shortest line.*/
705  return lw_dist3d_ptarray_poly(poly2->rings[0], poly1,&plane, dl);
706 }
double distance
Definition: measures3d.h:41
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
int twisted
Definition: measures3d.h:45
Definition: liblwgeom.h:459
int mode
Definition: measures3d.h:44
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 poi...
Definition: measures3d.c:1134
#define DIST_MAX
Definition: measures.h:40
int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinations of segments between two pointarrays.
Definition: measures3d.c:841
int lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
Computes pointarray to polygon distance.
Definition: measures3d.c:1051
Here is the call graph for this function:
Here is the caller graph for this function: