Compute centroid is implemented by non-vecotorize method