PostGIS  2.3.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 1237 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().

1238 {
1239  int t, u;
1240  const POINT2D *A1;
1241  const POINT2D *A2;
1242  const POINT2D *A3;
1243  const POINT2D *B1;
1244  const POINT2D *B2;
1245  const POINT2D *B3;
1246  int twist = dl->twisted;
1247 
1248  LWDEBUGF(2, "lw_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
1249 
1250  if (dl->mode == DIST_MAX)
1251  {
1252  lwerror("lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1253  return LW_FALSE;
1254  }
1255  else
1256  {
1257  A1 = getPoint2d_cp(pa, 0);
1258  for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
1259  {
1260  A2 = getPoint2d_cp(pa, t);
1261  A3 = getPoint2d_cp(pa, t+1);
1262  B1 = getPoint2d_cp(pb, 0);
1263  for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
1264  {
1265  B2 = getPoint2d_cp(pb, u);
1266  B3 = getPoint2d_cp(pb, u+1);
1267  dl->twisted = twist;
1268 
1269  lw_dist2d_arc_arc(A1, A2, A3, B1, B2, B3, dl);
1270 
1271  /* If we've found a distance within tolerance, we're done */
1272  if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
1273  return LW_TRUE;
1274 
1275  B1 = B3;
1276  }
1277  A1 = A3;
1278  }
1279  }
1280  return LW_TRUE;
1281 }
int npoints
Definition: liblwgeom.h:370
int mode
Definition: measures.h:51
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:1493
double tolerance
Definition: measures.h:53
#define DIST_MIN
Definition: measures.h:41
#define LW_FALSE
Definition: liblwgeom.h:76
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:485
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
int twisted
Definition: measures.h:52
double distance
Definition: measures.h:48
#define DIST_MAX
Definition: measures.h:40
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102

Here is the call graph for this function:

Here is the caller graph for this function: