PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWPOINT * cart_to_lwpoint ( const double_t  x_sum,
const double_t  y_sum,
const double_t  z_sum,
const double_t  weight_sum,
const uint32_t  srid 
)

Definition at line 231 of file geography_centroid.c.

References lwpoint_make2d(), r, pixval::x, and pixval::y.

Referenced by geography_centroid_from_wpoints().

232 {
233  double_t x = x_sum / weight_sum;
234  double_t y = y_sum / weight_sum;
235  double_t z = z_sum / weight_sum;
236 
237  /* x-y-z vector length */
238  double_t r = sqrtl(powl(x, 2) + powl(y, 2) + powl(z, 2));
239 
240  double_t lon = atan2l(y, x) * 180 / M_PI;
241  double_t lat = acosl(z / r) * 180 / M_PI - 90;
242 
243  return lwpoint_make2d(srid, lon, lat);
244 }
char * r
Definition: cu_in_wkt.c:24
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:163
tuple x
Definition: pixval.py:53
tuple y
Definition: pixval.py:54

Here is the call graph for this function:

Here is the caller graph for this function: