PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lw_dist3d_poly_poly()

int lw_dist3d_poly_poly ( LWPOLY poly1,
LWPOLY poly2,
DISTPTS3D dl 
)

polygon to polygon calculation

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

686 {
687  PLANE3D plane;
688  LWDEBUG(2, "lw_dist3d_poly_poly is called");
689  if (dl->mode == DIST_MAX)
690  {
691  return lw_dist3d_ptarray_ptarray(poly1->rings[0], poly2->rings[0], dl);
692  }
693 
694  if(!define_plane(poly2->rings[0], &plane))
695  return LW_FALSE;
696 
697  /*What we do here is to compare the bondary of one polygon with the other polygon
698  and then take the second boudary comparing with the first polygon*/
699  dl->twisted=1;
700  if(!lw_dist3d_ptarray_poly(poly1->rings[0], poly2,&plane, dl))
701  return LW_FALSE;
702  if(dl->distance==0.0) /*Just check if the answer already is given*/
703  return LW_TRUE;
704 
705  if(!define_plane(poly1->rings[0], &plane))
706  return LW_FALSE;
707  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.*/
708  return lw_dist3d_ptarray_poly(poly2->rings[0], poly1,&plane, dl);
709 }
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
POINTARRAY ** rings
Definition: liblwgeom.h:456
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 pon...
Definition: measures3d.c:1137
#define DIST_MAX
Definition: measures.h:40
int lw_dist3d_ptarray_ptarray(POINTARRAY *l1, POINTARRAY *l2, DISTPTS3D *dl)
Finds all combinationes of segments between two pointarrays.
Definition: measures3d.c:844
int lw_dist3d_ptarray_poly(POINTARRAY *pa, LWPOLY *poly, PLANE3D *plane, DISTPTS3D *dl)
Computes pointarray to polygon distance.
Definition: measures3d.c:1054
Here is the call graph for this function:
Here is the caller graph for this function: