PostGIS  2.2.7dev-r@@SVN_REVISION@@
int lw_dist2d_ptarrayarc_ptarrayarc ( const POINTARRAY pa,
const POINTARRAY pb,
DISTPTS dl 
)

Test each arc of pa against each arc of pb for distance.

Definition at line 1223 of file measures.c.

References DIST_MAX, DIST_MIN, DISTPTS::distance, getPoint2d_cp(), lw_dist2d_arc_arc(), LW_FALSE, LW_TRUE, LWDEBUGF, lwerror(), DISTPTS::mode, POINTARRAY::npoints, DISTPTS::tolerance, and DISTPTS::twisted.

Referenced by lw_dist2d_circstring_circstring().

1224 {
1225  int t, u;
1226  const POINT2D *A1;
1227  const POINT2D *A2;
1228  const POINT2D *A3;
1229  const POINT2D *B1;
1230  const POINT2D *B2;
1231  const POINT2D *B3;
1232  int twist = dl->twisted;
1233 
1234  LWDEBUGF(2, "lw_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
1235 
1236  if (dl->mode == DIST_MAX)
1237  {
1238  lwerror("lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1239  return LW_FALSE;
1240  }
1241  else
1242  {
1243  A1 = getPoint2d_cp(pa, 0);
1244  for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
1245  {
1246  A2 = getPoint2d_cp(pa, t);
1247  A3 = getPoint2d_cp(pa, t+1);
1248  B1 = getPoint2d_cp(pb, 0);
1249  for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
1250  {
1251  B2 = getPoint2d_cp(pb, u);
1252  B3 = getPoint2d_cp(pb, u+1);
1253  dl->twisted = twist;
1254 
1255  lw_dist2d_arc_arc(A1, A2, A3, B1, B2, B3, dl);
1256 
1257  /* If we've found a distance within tolerance, we're done */
1258  if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
1259  return LW_TRUE;
1260 
1261  B1 = B3;
1262  }
1263  A1 = A3;
1264  }
1265  }
1266  return LW_TRUE;
1267 }
int npoints
Definition: liblwgeom.h:355
int mode
Definition: measures.h:27
int lw_dist2d_arc_arc(const POINT2D *A1, const POINT2D *A2, const POINT2D *A3, const POINT2D *B1, const POINT2D *B2, const POINT2D *B3, DISTPTS *dl)
Definition: measures.c:1479
double tolerance
Definition: measures.h:29
#define DIST_MIN
Definition: measures.h:17
#define LW_FALSE
Definition: liblwgeom.h:62
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
Definition: lwgeom_api.c:472
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
int twisted
Definition: measures.h:28
double distance
Definition: measures.h:24
#define DIST_MAX
Definition: measures.h:16
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:74

Here is the call graph for this function:

Here is the caller graph for this function: