Parameterize ratio, fix centroidIdx issue