PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lw_dist2d_ptarrayarc_ptarrayarc()

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 1241 of file measures.c.

1242 {
1243  uint32_t t, u;
1244  const POINT2D *A1;
1245  const POINT2D *A2;
1246  const POINT2D *A3;
1247  const POINT2D *B1;
1248  const POINT2D *B2;
1249  const POINT2D *B3;
1250  int twist = dl->twisted;
1251 
1252  LWDEBUGF(2, "lw_dist2d_ptarrayarc_ptarrayarc called (points: %d-%d)",pa->npoints, pb->npoints);
1253 
1254  if (dl->mode == DIST_MAX)
1255  {
1256  lwerror("lw_dist2d_ptarrayarc_ptarrayarc does not currently support DIST_MAX mode");
1257  return LW_FALSE;
1258  }
1259  else
1260  {
1261  A1 = getPoint2d_cp(pa, 0);
1262  for ( t=1; t < pa->npoints; t += 2 ) /* For each segment in pa */
1263  {
1264  A2 = getPoint2d_cp(pa, t);
1265  A3 = getPoint2d_cp(pa, t+1);
1266  B1 = getPoint2d_cp(pb, 0);
1267  for ( u=1; u < pb->npoints; u += 2 ) /* For each arc in pb */
1268  {
1269  B2 = getPoint2d_cp(pb, u);
1270  B3 = getPoint2d_cp(pb, u+1);
1271  dl->twisted = twist;
1272 
1273  lw_dist2d_arc_arc(A1, A2, A3, B1, B2, B3, dl);
1274 
1275  /* If we've found a distance within tolerance, we're done */
1276  if ( dl->distance <= dl->tolerance && dl->mode == DIST_MIN )
1277  return LW_TRUE;
1278 
1279  B1 = B3;
1280  }
1281  A1 = A3;
1282  }
1283  }
1284  return LW_TRUE;
1285 }
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
Definition: lwgeom_api.c:374
#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:190
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:1497
#define DIST_MIN
Definition: measures.h:44
#define DIST_MAX
Definition: measures.h:43
int twisted
Definition: measures.h:55
double tolerance
Definition: measures.h:56
int mode
Definition: measures.h:54
double distance
Definition: measures.h:51
uint32_t npoints
Definition: liblwgeom.h:374
unsigned int uint32_t
Definition: uthash.h:78

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().

Here is the call graph for this function:
Here is the caller graph for this function: