2 #include <grass/cluster.h> 
   15     for (c = 0; c < C->nclasses; c++) {
 
   17         for (band = 0; band < C->nbands; band++)
 
   18             C->sumdiff[band][c] = 0;
 
   23     for (p = 0; p < C->npoints; p++) {
 
   31         for (c = 0; c < C->nclasses; c++) {
 
   36             for (band = 0; band < C->nbands; band++) {
 
   37                 z = C->points[band][p] * np - C->sum[band][c];
 
   42             if (first || (d < min)) {
 
   49         if (C->class[p] != 
class) {
 
   54             C->countdiff[
class]++;
 
   57             for (band = 0; band < C->nbands; band++) {
 
   58                 q = C->points[band][p];
 
   59                 C->sumdiff[band][
class] += 
q;
 
   60                 C->sumdiff[band][
old] -= 
q;
 
   66         for (c = 0; c < C->nclasses; c++) {
 
   67             C->count[c] += C->countdiff[c];
 
   68             for (band = 0; band < C->nbands; band++)
 
   69                 C->sum[band][c] += C->sumdiff[band][c];
 
#define HUGE_VAL
Values needed for Ray-Convex Polyhedron Intersection Test below originally by Eric Haines...
 
int I_cluster_reassign(struct Cluster *C, int *interrupted)