PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ _lwt_InitEdgeEndByLine()

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

Definition at line 1466 of file lwgeom_topo.c.

1468 {
1469  POINTARRAY *pa = edge->points;
1470  POINT2D pt;
1471 
1472  fee->nextCW = fee->nextCCW =
1473  lee->nextCW = lee->nextCCW = 0;
1474  fee->cwFace = fee->ccwFace =
1475  lee->cwFace = lee->ccwFace = -1;
1476 
1477  /* Compute azimuth of first edge end */
1478  LWDEBUG(1, "computing azimuth of first edge end");
1479  if ( ! _lwt_FirstDistinctVertex2D(pa, fp, 0, 1, &pt) )
1480  {
1481  lwerror("Invalid edge (no two distinct vertices exist)");
1482  return -1;
1483  }
1484  if ( ! azimuth_pt_pt(fp, &pt, &(fee->myaz)) ) {
1485  lwerror("error computing azimuth of first edgeend [%.15g %.15g,%.15g %.15g]",
1486  fp->x, fp->y, pt.x, pt.y);
1487  return -2;
1488  }
1489  LWDEBUGF(1, "azimuth of first edge end [%.15g %.15g,%.15g %.15g] is %g",
1490  fp->x, fp->y, pt.x, pt.y, fee->myaz);
1491 
1492  /* Compute azimuth of second edge end */
1493  LWDEBUG(1, "computing azimuth of second edge end");
1494  if ( ! _lwt_FirstDistinctVertex2D(pa, lp, pa->npoints-1, -1, &pt) )
1495  {
1496  lwerror("Invalid edge (no two distinct vertices exist)");
1497  return -1;
1498  }
1499  if ( ! azimuth_pt_pt(lp, &pt, &(lee->myaz)) ) {
1500  lwerror("error computing azimuth of last edgeend [%.15g %.15g,%.15g %.15g]",
1501  lp->x, lp->y, pt.x, pt.y);
1502  return -2;
1503  }
1504  LWDEBUGF(1, "azimuth of last edge end [%.15g %.15g,%.15g %.15g] is %g",
1505  lp->x, lp->y, pt.x, pt.y, lee->myaz);
1506 
1507  return 0;
1508 }
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
Definition: measures.c:2509
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:101
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:106
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, const POINT2D *ref, int from, int dir, POINT2D *op)
Definition: lwgeom_topo.c:1428
POINTARRAY * points
Definition: liblwgeom.h:483
double y
Definition: liblwgeom.h:390
double x
Definition: liblwgeom.h:390
uint32_t npoints
Definition: liblwgeom.h:427
double myaz
Definition: lwgeom_topo.c:1415
LWT_ELEMID nextCCW
Definition: lwgeom_topo.c:1411
LWT_ELEMID ccwFace
Definition: lwgeom_topo.c:1413
LWT_ELEMID cwFace
Definition: lwgeom_topo.c:1409
LWT_ELEMID nextCW
Definition: lwgeom_topo.c:1407

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

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