PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ LWGEOM_longestline3d()

Datum LWGEOM_longestline3d ( PG_FUNCTION_ARGS  )

Definition at line 888 of file lwgeom_functions_basic.c.

References error_if_srid_mismatch(), geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_furthest_line_3d(), lwgeom_is_empty(), LWGEOM_mindistance3d(), PG_FUNCTION_INFO_V1(), and LWGEOM::srid.

Referenced by LWGEOM_shortestline3d().

889 {
890  GSERIALIZED *result;
891  GSERIALIZED *geom1 = PG_GETARG_GSERIALIZED_P(0);
892  GSERIALIZED *geom2 = PG_GETARG_GSERIALIZED_P(1);
893  LWGEOM *theline;
894  LWGEOM *lwgeom1 = lwgeom_from_gserialized(geom1);
895  LWGEOM *lwgeom2 = lwgeom_from_gserialized(geom2);
896 
897  error_if_srid_mismatch(lwgeom1->srid, lwgeom2->srid);
898 
899  theline = lwgeom_furthest_line_3d(lwgeom1, lwgeom2);
900  // theline = lw_dist3d_distanceline(lwgeom1, lwgeom2, lwgeom1->srid, DIST_MAX);
901 
902  if (lwgeom_is_empty(theline))
903  PG_RETURN_NULL();
904 
905  result = geometry_serialize(theline);
906 
907  lwgeom_free(theline);
908  lwgeom_free(lwgeom1);
909  lwgeom_free(lwgeom2);
910 
911  PG_FREE_IF_COPY(geom1, 0);
912  PG_FREE_IF_COPY(geom2, 1);
913  PG_RETURN_POINTER(result);
914 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:338
LWGEOM * lwgeom_furthest_line_3d(LWGEOM *lw1, LWGEOM *lw2)
Definition: measures3d.c:94
int32_t srid
Definition: liblwgeom.h:401
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1393
Here is the call graph for this function:
Here is the caller graph for this function: