1493 uint64_t numedges = 1;
1495 double minaz, maxaz;
1503 if ( azdif < 0 ) azdif += 2 * M_PI;
1504 minaz = maxaz = azdif;
1506 LWDEBUGF(1,
"Other edge end has cwFace=%d and ccwFace=%d",
1513 " and adjacent to azimuth %g", node,
data->myaz);
1517 if (numedges == UINT64_MAX)
1523 LWDEBUGF(1,
"getEdgeByNode returned %d edges, minaz=%g, maxaz=%g",
1524 numedges, minaz, maxaz);
1527 for ( i = 0; i < numedges; ++i )
1537 if ( edge->
edge_id == myedge_id )
continue;
1550 " does not have two distinct points",
id);
1558 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1564 ", edgeend is %g,%g-%g,%g",
1570 lwerror(
"error computing azimuth of edge %d first edgeend [%.15g %.15g,%.15g %.15g]",
1571 id, p1.
x, p1.
y, p2.
x, p2.
y);
1574 azdif = az -
data->myaz;
1576 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1578 if ( azdif < 0 ) azdif += 2 * M_PI;
1579 if ( minaz == -1 ) {
1580 minaz = maxaz = azdif;
1587 " (face_right is new ccwFace, face_left is new cwFace)",
1591 if ( azdif < minaz ) {
1597 " (previous had minaz=%g, face_left is new cwFace)",
1602 else if ( azdif > maxaz ) {
1608 " (previous had maxaz=%g, face_right is new ccwFace)",
1620 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1625 ", edgeend is %g,%g-%g,%g",
1631 lwerror(
"error computing azimuth of edge %d last edgeend [%.15g %.15g,%.15g %.15g]",
1632 id, p1.
x, p1.
y, p2.
x, p2.
y);
1635 azdif = az -
data->myaz;
1637 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1638 if ( azdif < 0 ) azdif += 2 * M_PI;
1639 if ( minaz == -1 ) {
1640 minaz = maxaz = azdif;
1647 " (face_right is new cwFace, face_left is new ccwFace)",
1651 if ( azdif < minaz ) {
1657 " (previous had minaz=%g, face_right is new cwFace)",
1662 else if ( azdif > maxaz ) {
1666 ", outgoing, from start point, "
1668 " (previous had maxaz=%g, face_left is new ccwFace)",
1680 LWDEBUGF(1,
"edges adjacent to azimuth %g"
1683 data->myaz, node,
data->nextCW, minaz,
1684 data->nextCCW, maxaz);
1686 if ( myedge_id < 1 && numedges && data->cwFace !=
data->ccwFace )
1688 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 LWT_ISO_EDGE * lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, uint64_t *numelems, int fields)
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, POINT2D *ref, int from, int dir, POINT2D *op)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
const LWT_BE_IFACE * be_iface