1498 double minaz, maxaz;
1506 if ( azdif < 0 ) azdif += 2 * M_PI;
1507 minaz = maxaz = azdif;
1509 LWDEBUGF(1,
"Other edge end has cwFace=%d and ccwFace=%d",
1516 " and adjacent to azimuth %g", node,
data->myaz);
1520 if ( numedges == -1 ) {
1525 LWDEBUGF(1,
"getEdgeByNode returned %d edges, minaz=%g, maxaz=%g",
1526 numedges, minaz, maxaz);
1529 for ( i = 0; i < numedges; ++i )
1539 if ( edge->
edge_id == myedge_id )
continue;
1552 " does not have two distinct points",
id);
1560 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1566 ", edgeend is %g,%g-%g,%g",
1572 lwerror(
"error computing azimuth of edge %d first edgeend [%.15g %.15g,%.15g %.15g]",
1573 id, p1.
x, p1.
y, p2.
x, p2.
y);
1576 azdif = az -
data->myaz;
1578 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1580 if ( azdif < 0 ) azdif += 2 * M_PI;
1581 if ( minaz == -1 ) {
1582 minaz = maxaz = azdif;
1589 " (face_right is new ccwFace, face_left is new cwFace)",
1593 if ( azdif < minaz ) {
1599 " (previous had minaz=%g, face_left is new cwFace)",
1604 else if ( azdif > maxaz ) {
1610 " (previous had maxaz=%g, face_right is new ccwFace)",
1622 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1627 ", edgeend is %g,%g-%g,%g",
1633 lwerror(
"error computing azimuth of edge %d last edgeend [%.15g %.15g,%.15g %.15g]",
1634 id, p1.
x, p1.
y, p2.
x, p2.
y);
1637 azdif = az -
data->myaz;
1639 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1640 if ( azdif < 0 ) azdif += 2 * M_PI;
1641 if ( minaz == -1 ) {
1642 minaz = maxaz = azdif;
1649 " (face_right is new cwFace, face_left is new ccwFace)",
1653 if ( azdif < minaz ) {
1659 " (previous had minaz=%g, face_right is new cwFace)",
1664 else if ( azdif > maxaz ) {
1668 ", outgoing, from start point, "
1670 " (previous had maxaz=%g, face_left is new ccwFace)",
1682 LWDEBUGF(1,
"edges adjacent to azimuth %g"
1685 data->myaz, node,
data->nextCW, minaz,
1686 data->nextCCW, maxaz);
1688 if ( myedge_id < 1 && numedges && data->cwFace !=
data->ccwFace )
1690 if (
data->cwFace != -1 &&
data->ccwFace != -1 ) {
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
void lwgeom_free(LWGEOM *geom)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, POINT2D *ref, int from, int dir, POINT2D *op)
static LWT_ISO_EDGE * lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, int *numelems, int fields)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
const LWT_BE_IFACE * be_iface