2479{
2484 int32_t srid;
2485
2486
2487 geom = PG_GETARG_GSERIALIZED_P(0);
2489 if (!lwpoint)
2490 {
2491 PG_FREE_IF_COPY(geom, 0);
2492 lwpgerror("Argument must be POINT geometries");
2493 PG_RETURN_NULL();
2494 }
2495 srid = lwpoint->
srid;
2497 {
2498 PG_FREE_IF_COPY(geom, 0);
2499 lwpgerror("Error extracting point");
2500 PG_RETURN_NULL();
2501 }
2503 PG_FREE_IF_COPY(geom, 0);
2504
2505
2506 geom = PG_GETARG_GSERIALIZED_P(1);
2508 if (!lwpoint)
2509 {
2510 PG_FREE_IF_COPY(geom, 1);
2511 lwpgerror("Argument must be POINT geometries");
2512 PG_RETURN_NULL();
2513 }
2514 if (lwpoint->
srid != srid)
2515 {
2516 PG_FREE_IF_COPY(geom, 1);
2517 lwpgerror("Operation on mixed SRID geometries");
2518 PG_RETURN_NULL();
2519 }
2521 {
2522 PG_FREE_IF_COPY(geom, 1);
2523 lwpgerror("Error extracting point");
2524 PG_RETURN_NULL();
2525 }
2527 PG_FREE_IF_COPY(geom, 1);
2528
2529
2530 if ((p1.
x == p2.
x) && (p1.
y == p2.
y))
2531 {
2532 PG_RETURN_NULL();
2533 }
2534
2535
2537 {
2538 PG_RETURN_NULL();
2539 }
2540
2541 PG_RETURN_FLOAT8(
result);
2542}
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int azimuth_pt_pt(const POINT2D *p1, const POINT2D *p2, double *ret)
Compute the azimuth of segment AB in radians.
void lwpoint_free(LWPOINT *pt)
int getPoint2d_p(const POINTARRAY *pa, uint32_t n, POINT2D *point)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)