PostGIS 3.0.6dev-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 1431 of file lwgeom_topo.c.

1433{
1434 POINTARRAY *pa = edge->points;
1435 POINT2D pt;
1436
1437 fee->nextCW = fee->nextCCW =
1438 lee->nextCW = lee->nextCCW = 0;
1439 fee->cwFace = fee->ccwFace =
1440 lee->cwFace = lee->ccwFace = -1;
1441
1442 /* Compute azimuth of first edge end */
1443 LWDEBUG(1, "computing azimuth of first edge end");
1444 if ( ! _lwt_FirstDistinctVertex2D(pa, fp, 0, 1, &pt) )
1445 {
1446 lwerror("Invalid edge (no two distinct vertices exist)");
1447 return -1;
1448 }
1449 if ( ! azimuth_pt_pt(fp, &pt, &(fee->myaz)) ) {
1450 lwerror("error computing azimuth of first edgeend [%.15g %.15g,%.15g %.15g]",
1451 fp->x, fp->y, pt.x, pt.y);
1452 return -2;
1453 }
1454 LWDEBUGF(1, "azimuth of first edge end [%.15g %.15g,%.15g %.15g] is %g",
1455 fp->x, fp->y, pt.x, pt.y, fee->myaz);
1456
1457 /* Compute azimuth of second edge end */
1458 LWDEBUG(1, "computing azimuth of second edge end");
1459 if ( ! _lwt_FirstDistinctVertex2D(pa, lp, pa->npoints-1, -1, &pt) )
1460 {
1461 lwerror("Invalid edge (no two distinct vertices exist)");
1462 return -1;
1463 }
1464 if ( ! azimuth_pt_pt(lp, &pt, &(lee->myaz)) ) {
1465 lwerror("error computing azimuth of last edgeend [%.15g %.15g,%.15g %.15g]",
1466 lp->x, lp->y, pt.x, pt.y);
1467 return -2;
1468 }
1469 LWDEBUGF(1, "azimuth of last edge end [%.15g %.15g,%.15g %.15g] is %g",
1470 lp->x, lp->y, pt.x, pt.y, lee->myaz);
1471
1472 return 0;
1473}
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
Definition measures.c:2461
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition lwgeom_log.h:88
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static int _lwt_FirstDistinctVertex2D(const POINTARRAY *pa, POINT2D *ref, int from, int dir, POINT2D *op)
POINTARRAY * points
Definition liblwgeom.h:469
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376
uint32_t npoints
Definition liblwgeom.h:413
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: