Next: , Previous: center_variter, Up: imagefcts   [Contents]


12.3 weightpos

determine the mean weighted position of a group of objects

Synopsis

#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)
);

Parameters

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

Description

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.

Returns

It returns the mean weighted position of the group.

Author

Diab Jerius