Chapter 9.1 : What is a barycentre ?

A barycentre is an average of the values of a vector.

In our case, it will be a average on two dimensions with a signal.

Mathematicaly it is :
nothing

In C++ code :

1
2
3
4
5
6
7
8
9
10
void barycentre(float & gx, float & gy, const float * tabX, const float* tabY, const float* tabA, long unsigned int nbElement){
	gx = 0.0f;
	gy = 0.0f;
	for(long unsigned int i(0lu); i < nbElement; ++i){
		gx += tabX[i]*tabA[i];
		gy += tabY[i]*tabA[i];
	}
	gx /= (float)nbElement;
	gy /= (float)nbElement;
}