Previous Application/exercice : Optimisation barycentre computation |
Parent Application/exercice : Optimisation barycentre computation |
Outline | Next The classical approach |
In our case, it will be a average on two dimensions with a signal.
Mathematicaly it is :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; } |
Previous Application/exercice : Optimisation barycentre computation |
Parent Application/exercice : Optimisation barycentre computation |
Outline | Next The classical approach |