I think there was a slight error in the radiusOfSphereForStick calculation. Here's what's working for me: radiusOfSphereForStick=(radiusOfCapCrossection*radiusOfCapCrossection+heightOfCap*heightOfCap)/(2*heightOfCap);