the second one is quite right. there are two central methods these calculations are based on, and that're minimalGridAABB and minimalGridSphere, those should stay in the class. 
maybe a followup issue if this is too much work for you in this moment.