2395{
2399 double result;
2400 int32_t srid;
2401
2402
2403 geom = PG_GETARG_GSERIALIZED_P(0);
2405 if (!lwpoint)
2406 {
2407 PG_FREE_IF_COPY(geom, 0);
2408 lwpgerror("Argument must be POINT geometries");
2409 PG_RETURN_NULL();
2410 }
2411 srid = lwpoint->
srid;
2413 {
2414 PG_FREE_IF_COPY(geom, 0);
2415 lwpgerror("Error extracting point");
2416 PG_RETURN_NULL();
2417 }
2419 PG_FREE_IF_COPY(geom, 0);
2420
2421
2422 geom = PG_GETARG_GSERIALIZED_P(1);
2424 if (!lwpoint)
2425 {
2426 PG_FREE_IF_COPY(geom, 1);
2427 lwpgerror("Argument must be POINT geometries");
2428 PG_RETURN_NULL();
2429 }
2430 if (lwpoint->
srid != srid)
2431 {
2432 PG_FREE_IF_COPY(geom, 1);
2433 lwpgerror("Operation on mixed SRID geometries");
2434 PG_RETURN_NULL();
2435 }
2437 {
2438 PG_FREE_IF_COPY(geom, 1);
2439 lwpgerror("Error extracting point");
2440 PG_RETURN_NULL();
2441 }
2443 PG_FREE_IF_COPY(geom, 1);
2444
2445
2446 if ((p1.
x == p2.
x) && (p1.
y == p2.
y))
2447 {
2448 PG_RETURN_NULL();
2449 }
2450
2451
2453 {
2454 PG_RETURN_NULL();
2455 }
2456
2457 PG_RETURN_FLOAT8(result);
2458}
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)