PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ lwgeom_median()

LWPOINT* lwgeom_median ( const LWGEOM g,
double  tol,
uint32_t  max_iter,
char  fail_if_not_converged 
)

Definition at line 281 of file lwgeom_median.c.

282 {
283  switch (g->type)
284  {
285  case POINTTYPE:
286  return lwpoint_clone(lwgeom_as_lwpoint(g));
287  case MULTIPOINTTYPE:
288  return lwmpoint_median(lwgeom_as_lwmpoint(g), tol, max_iter, fail_if_not_converged);
289  default:
290  lwerror("%s: Unsupported geometry type: %s", __func__, lwtype_name(g->type));
291  return NULL;
292  }
293 }
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:242
#define MULTIPOINTTYPE
Definition: liblwgeom.h:105
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
Definition: lwutil.c:216
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:239
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.
LWPOINT * lwmpoint_median(const LWMPOINT *g, double tol, uint32_t max_iter, char fail_if_not_converged)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwinline.h:127
uint8_t type
Definition: liblwgeom.h:462

References lwerror(), lwgeom_as_lwmpoint(), lwgeom_as_lwpoint(), lwmpoint_median(), lwpoint_clone(), lwtype_name(), MULTIPOINTTYPE, POINTTYPE, and LWGEOM::type.

Referenced by do_median_dims_check(), do_median_test(), and ST_GeometricMedian().

Here is the call graph for this function:
Here is the caller graph for this function: