PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ _lwt_InitEdgeEndByLine()

static int _lwt_InitEdgeEndByLine ( edgeend fee,
edgeend lee,
LWLINE edge,
POINT2D fp,
POINT2D lp 
)
static

Definition at line 1453 of file lwgeom_topo.c.

References _lwt_FirstDistinctVertex2D(), azimuth_pt_pt(), edgeend_t::ccwFace, edgeend_t::cwFace, LWDEBUG, LWDEBUGF, lwerror(), edgeend_t::myaz, edgeend_t::nextCCW, edgeend_t::nextCW, POINTARRAY::npoints, LWLINE::points, POINT2D::x, and POINT2D::y.

Referenced by lwt_ChangeEdgeGeom().

1455 {
1456  POINTARRAY *pa = edge->points;
1457  POINT2D pt;
1458 
1459  fee->nextCW = fee->nextCCW =
1460  lee->nextCW = lee->nextCCW = 0;
1461  fee->cwFace = fee->ccwFace =
1462  lee->cwFace = lee->ccwFace = -1;
1463 
1464  /* Compute azimuth of first edge end */
1465  LWDEBUG(1, "computing azimuth of first edge end");
1466  if ( ! _lwt_FirstDistinctVertex2D(pa, fp, 0, 1, &pt) )
1467  {
1468  lwerror("Invalid edge (no two distinct vertices exist)");
1469  return -1;
1470  }
1471  if ( ! azimuth_pt_pt(fp, &pt, &(fee->myaz)) ) {
1472  lwerror("error computing azimuth of first edgeend [%g %g,%g %g]",
1473  fp->x, fp->y, pt.x, pt.y);
1474  return -2;
1475  }
1476  LWDEBUGF(1, "azimuth of first edge end [%g %g,%g %g] is %g",
1477  fp->x, fp->y, pt.x, pt.y, fee->myaz);
1478 
1479  /* Compute azimuth of second edge end */
1480  LWDEBUG(1, "computing azimuth of second edge end");
1481  if ( ! _lwt_FirstDistinctVertex2D(pa, lp, pa->npoints-1, -1, &pt) )
1482  {
1483  lwerror("Invalid edge (no two distinct vertices exist)");
1484  return -1;
1485  }
1486  if ( ! azimuth_pt_pt(lp, &pt, &(lee->myaz)) ) {
1487  lwerror("error computing azimuth of last edgeend [%g %g,%g %g]",
1488  lp->x, lp->y, pt.x, pt.y);
1489  return -2;
1490  }
1491  LWDEBUGF(1, "azimuth of last edge end [%g %g,%g %g] is %g",
1492  lp->x, lp->y, pt.x, pt.y, lee->myaz);
1493 
1494  return 0;
1495 }
int npoints
Definition: liblwgeom.h:355
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, POINT2D *ref, int from, int dir, POINT2D *op)
Definition: lwgeom_topo.c:1414
LWT_ELEMID cwFace
Definition: lwgeom_topo.c:1395
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
LWT_ELEMID nextCCW
Definition: lwgeom_topo.c:1397
double x
Definition: liblwgeom.h:312
double myaz
Definition: lwgeom_topo.c:1401
double y
Definition: liblwgeom.h:312
LWT_ELEMID ccwFace
Definition: lwgeom_topo.c:1399
LWT_ELEMID nextCW
Definition: lwgeom_topo.c:1393
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
Definition: measures.c:2412
#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
POINTARRAY * points
Definition: liblwgeom.h:406
Here is the call graph for this function:
Here is the caller graph for this function: