173{
174 uint32_t i;
175 uint32_t n = 0;
178
179 for (i = 0; i < g->
ngeoms; i++)
180 {
183 {
186 {
187 lwerror(
"Geometric median: getPoint4d_p reported failure on point (POINT(%g %g %g %g), number %d of %d in input).", points[n].x, points[n].y, points[n].z, points[n].m, i, g->
ngeoms);
189 return NULL;
190 }
191 if (has_m)
192 {
193
194
195
196
197
198
199
200
201
202 if (points[n].m < 0)
203 {
204 lwerror(
"Geometric median input contains points with negative weights (POINT(%g %g %g %g), number %d of %d in input). Implementation can't guarantee global minimum convergence.", points[n].x, points[n].y, points[n].z, points[n].m, i, g->
ngeoms);
206 return NULL;
207 }
208
209
210 if (points[n].m > DBL_EPSILON) n++;
211 }
212 else
213 {
215 n++;
216 }
217 }
218 }
219
220#if PARANOIA_LEVEL > 0
221
223#endif
224
225 *npoints = n;
226 return points;
227}
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
void * lwalloc(size_t size)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
LWGEOM * lwcollection_getsubgeom(LWCOLLECTION *col, int gnum)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)