Next: wtvar, Previous: center_variter, Up: imagefcts [Contents]
determine the mean weighted position of a group of objects
#include <suplib/imagefcts.h> double weightpos( void *objs, unsigned long n_tot, double tot_wt, size_t s_obj, double (*get_x)(const void *obj,double *x) );
void *objs
list of objects whose mean position is to be determined
unsigned long n_tot
total number of objects to process
double tot_wt
total weight of objects. if zero, each object is assumed to have a weight of 1.
size_t s_obj
size of an object
double (*get_x)(const void *obj,double *x)
function which returns the position and weight of an object
determine the mean weighted position of a group of objects. requires a user supplied function which extracts an object’s position and weight. designed to be run over sub-groups of the list (for low memory situations). optimized for both weighted and unweighted (weight = 1) data.
It returns the mean weighted position of the group.
Diab Jerius