PostGIS  2.1.10dev-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 1197 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().

1198 {
1199  int t, u;
1200  const POINT2D *A1;
1201  const POINT2D *A2;
1202  const POINT2D *A3;
1203  const POINT2D *B1;
1204  const POINT2D *B2;
1205  const POINT2D *B3;
1206  int twist = dl->twisted;
1207 
1208  LWDEBUGF(2, "lw_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
1209 
1210  if (dl->mode == DIST_MAX)
1211  {
1212  lwerror("lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1213  return LW_FALSE;
1214  }
1215  else
1216  {
1217  A1 = getPoint2d_cp(pa, 0);
1218  for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
1219  {
1220  A2 = getPoint2d_cp(pa, t);
1221  A3 = getPoint2d_cp(pa, t+1);
1222  B1 = getPoint2d_cp(pb, 0);
1223  for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
1224  {
1225  B2 = getPoint2d_cp(pb, u);
1226  B3 = getPoint2d_cp(pb, u+1);
1227  dl->twisted = twist;
1228 
1229  lw_dist2d_arc_arc(A1, A2, A3, B1, B2, B3, dl);
1230 
1231  /* If we've found a distance within tolerance, we're done */
1232  if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
1233  return LW_TRUE;
1234 
1235  B1 = B3;
1236  }
1237  A1 = A3;
1238  }
1239  }
1240  return LW_TRUE;
1241 }
int npoints
Definition: liblwgeom.h:327
#define DIST_MAX
int mode
Definition: measures.h:26
#define DIST_MIN
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:1438
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
double tolerance
Definition: measures.h:28
#define LW_FALSE
Definition: liblwgeom.h:52
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:458
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
int twisted
Definition: measures.h:27
double distance
Definition: measures.h:23
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55

Here is the call graph for this function:

Here is the caller graph for this function: