PostGIS  2.3.7dev-r@@SVN_REVISION@@
LWPOINT* lwgeom_median ( const LWGEOM g,
double  tol,
uint32_t  max_iter,
char  fail_if_not_converged 
)

Definition at line 203 of file lwgeom_median.c.

References lwerror(), lwgeom_as_lwmpoint(), lwgeom_as_lwpoint(), lwgeom_get_type(), lwmpoint_median(), lwpoint_clone(), MULTIPOINTTYPE, and POINTTYPE.

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

204 {
205  switch( lwgeom_get_type(g) )
206  {
207  case POINTTYPE:
208  return lwpoint_clone(lwgeom_as_lwpoint(g));
209  case MULTIPOINTTYPE:
210  return lwmpoint_median(lwgeom_as_lwmpoint(g), tol, max_iter, fail_if_not_converged);
211  default:
212  lwerror("Unsupported geometry type in lwgeom_median");
213  return NULL;
214  }
215 }
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:842
#define MULTIPOINTTYPE
Definition: liblwgeom.h:87
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:93
LWPOINT * lwpoint_clone(const LWPOINT *lwgeom)
Definition: lwpoint.c:221
LWPOINT * lwmpoint_median(const LWMPOINT *g, double tol, uint32_t max_iter, char fail_if_not_converged)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:84
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
Definition: lwgeom.c:165
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:102

Here is the call graph for this function:

Here is the caller graph for this function: