Fixing bug in findWeightedCentroidsImpl 

Fixing a bug in findWeightedCentroidsImpl where the outer bound of a centroid was not scanned.
This fixes the Nan problem