PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ _lwt_InitEdgeEndByLine()

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

Definition at line 1583 of file lwgeom_topo.c.

1585{
1586 POINTARRAY *pa = edge->points;
1587 POINT2D pt;
1588
1589 fee->nextCW = fee->nextCCW =
1590 lee->nextCW = lee->nextCCW = 0;
1591 fee->cwFace = fee->ccwFace =
1592 lee->cwFace = lee->ccwFace = -1;
1593
1594 /* Compute azimuth of first edge end */
1595 LWDEBUG(1, "computing azimuth of first edge end");
1596 if ( ! _lwt_FirstDistinctVertex2D(pa, fp, 0, 1, &pt) )
1597 {
1598 lwerror("Invalid edge (no two distinct vertices exist)");
1599 return -1;
1600 }
1601 if ( ! azimuth_pt_pt(fp, &pt, &(fee->myaz)) ) {
1602 lwerror("error computing azimuth of first edgeend [%.15g %.15g,%.15g %.15g]",
1603 fp->x, fp->y, pt.x, pt.y);
1604 return -2;
1605 }
1606 LWDEBUGF(1, "azimuth of first edge end [%.15g %.15g,%.15g %.15g] is %g",
1607 fp->x, fp->y, pt.x, pt.y, fee->myaz);
1608
1609 /* Compute azimuth of second edge end */
1610 LWDEBUG(1, "computing azimuth of second edge end");
1611 if ( ! _lwt_FirstDistinctVertex2D(pa, lp, pa->npoints-1, -1, &pt) )
1612 {
1613 lwerror("Invalid edge (no two distinct vertices exist)");
1614 return -1;
1615 }
1616 if ( ! azimuth_pt_pt(lp, &pt, &(lee->myaz)) ) {
1617 lwerror("error computing azimuth of last edgeend [%.15g %.15g,%.15g %.15g]",
1618 lp->x, lp->y, pt.x, pt.y);
1619 return -2;
1620 }
1621 LWDEBUGF(1, "azimuth of last edge end [%.15g %.15g,%.15g %.15g] is %g",
1622 lp->x, lp->y, pt.x, pt.y, lee->myaz);
1623
1624 return 0;
1625}
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
Definition measures.c:2408
#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)
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
LWT_ELEMID nextCCW
LWT_ELEMID ccwFace
LWT_ELEMID cwFace
LWT_ELEMID nextCW

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: