PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ cart_to_lwpoint()

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 232 of file geography_centroid.c.

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

Referenced by geography_centroid_from_wpoints().

233 {
234  double_t x = x_sum / weight_sum;
235  double_t y = y_sum / weight_sum;
236  double_t z = z_sum / weight_sum;
237 
238  /* x-y-z vector length */
239  double_t r = sqrtl(powl(x, 2) + powl(y, 2) + powl(z, 2));
240 
241  double_t lon = atan2l(y, x) * 180 / M_PI;
242  double_t lat = acosl(z / r) * 180 / M_PI - 90;
243 
244  return lwpoint_make2d(srid, lon, lat);
245 }
char * r
Definition: cu_in_wkt.c:24
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:163
Here is the call graph for this function:
Here is the caller graph for this function: