AxialBox EncloseABox ( Cylinder const & C ) { Vector center = C.getCenter(); Vector extent( C.getExtentX(), C.getExtentY(), C.getExtentZ() ); return AxialBox(center-extent,center+extent); }
Sphere EncloseSphere ( Cylinder const & shape ) { float x = shape.getExtentX(); float y = shape.getExtentY(); float radius = sqrt( x*x + y*y ); return Sphere( shape.getCenter(), radius ); }