Definition at line 1507 of file lwgeom_topo.c.
References _lwt_FirstDistinctVertex2D(), _lwt_release_edges(), azimuth_pt_pt(), LWT_TOPOLOGY_T::be_iface, edgeend_t::ccwFace, edgeend_t::cwFace, LWT_ISO_EDGE::edge_id, LWT_ISO_EDGE::end_node, LWT_ISO_EDGE::face_left, LWT_ISO_EDGE::face_right, LWT_ISO_EDGE::geom, getPoint2d_p(), LWDEBUGF, lwerror(), lwgeom_as_lwline(), lwgeom_free(), lwgeom_remove_repeated_points(), lwline_as_lwgeom(), lwt_be_getEdgeByNode(), lwt_be_lastErrorMessage(), LWT_COL_EDGE_ALL, LWTFMT_ELEMID, edgeend_t::myaz, edgeend_t::nextCCW, edgeend_t::nextCW, POINTARRAY::npoints, LWLINE::points, LWT_ISO_EDGE::start_node, POINT2D::x, and POINT2D::y.
Referenced by _lwt_AddEdge(), and lwt_ChangeEdgeGeom().
1513 double minaz, maxaz;
1521 if ( azdif < 0 ) azdif += 2 * M_PI;
1522 minaz = maxaz = azdif;
1524 LWDEBUGF(1,
"Other edge end has cwFace=%d and ccwFace=%d",
1531 " and adjacent to azimuth %g", node, data->
myaz);
1535 if ( numedges == -1 ) {
1540 LWDEBUGF(1,
"getEdgeByNode returned %d edges, minaz=%g, maxaz=%g",
1541 numedges, minaz, maxaz);
1544 for ( i = 0; i < numedges; ++i )
1554 if ( edge->
edge_id == myedge_id )
continue;
1567 " does not have two distinct points",
id);
1575 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1581 ", edgeend is %g,%g-%g,%g",
1587 lwerror(
"error computing azimuth of edge %d first edgeend [%.15g %.15g,%.15g %.15g]",
1588 id, p1.
x, p1.
y, p2.
x, p2.
y);
1591 azdif = az - data->
myaz;
1593 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1595 if ( azdif < 0 ) azdif += 2 * M_PI;
1596 if ( minaz == -1 ) {
1597 minaz = maxaz = azdif;
1604 " (face_right is new ccwFace, face_left is new cwFace)",
1608 if ( azdif < minaz ) {
1614 " (previous had minaz=%g, face_left is new cwFace)",
1619 else if ( azdif > maxaz ) {
1625 " (previous had maxaz=%g, face_right is new ccwFace)",
1637 lwerror(
"Edge %d has no distinct vertices: [%.15g %.15g,%.15g %.15g]: ",
1642 ", edgeend is %g,%g-%g,%g",
1648 lwerror(
"error computing azimuth of edge %d last edgeend [%.15g %.15g,%.15g %.15g]",
1649 id, p1.
x, p1.
y, p2.
x, p2.
y);
1652 azdif = az - data->
myaz;
1654 ": %g (diff: %g)", edge->
edge_id, az, azdif);
1655 if ( azdif < 0 ) azdif += 2 * M_PI;
1656 if ( minaz == -1 ) {
1657 minaz = maxaz = azdif;
1664 " (face_right is new cwFace, face_left is new ccwFace)",
1668 if ( azdif < minaz ) {
1674 " (previous had minaz=%g, face_right is new cwFace)",
1679 else if ( azdif > maxaz ) {
1683 ", outgoing, from start point, " 1685 " (previous had maxaz=%g, face_left is new ccwFace)",
1697 LWDEBUGF(1,
"edges adjacent to azimuth %g" 1703 if ( myedge_id < 1 && numedges && data->cwFace != data->
ccwFace )
void lwgeom_free(LWGEOM *geom)
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, POINT2D *ref, int from, int dir, POINT2D *op)
LWGEOM * lwline_as_lwgeom(const LWLINE *obj)
const LWT_BE_IFACE * be_iface
int getPoint2d_p(const POINTARRAY *pa, int n, POINT2D *point)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
static void _lwt_release_edges(LWT_ISO_EDGE *edges, int num_edges)
LWT_INT64 LWT_ELEMID
Identifier of topology element.
LWGEOM * lwgeom_remove_repeated_points(const LWGEOM *in, double tolerance)
Remove repeated points!
static LWT_ISO_EDGE * lwt_be_getEdgeByNode(LWT_TOPOLOGY *topo, const LWT_ELEMID *ids, int *numelems, int fields)
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
#define LWDEBUGF(level, msg,...)
const char * lwt_be_lastErrorMessage(const LWT_BE_IFACE *be)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.