I’m trying to figure out how to calculate the x and y centroids to be able to use my Manta as a 2D controller, combining the currently held pads. Searching around, i see integration formulas and stuff and my math skills are unfortunately not there to understand how to implement those in sc. Any help on how to solve this is highly appreciated!

My Manta has a 6x8 grid of touch sensitive pads and I have written a class that stores all my pad values between 0-1 in a 2D array so i’m getting something like this:

```
[
[ 0, 0, 0, 0, 0, 0.56498826028397, 0, 0 ],
[ 0.45307553537759, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0.017162084842514, 0.018331095896545, 0, 0, 0, 0, 0 ],
[ 0, 0.60755015816675, 0.47020854015963, 0.82371384159056, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
];
```

So, given this, how do i calculate the centroid for x and y?