public Volume3d createEnclosingVolume(Volume3d s1, Volume3d s2) {
   switch (chainTree.volumeMode) {
     case OBB:
       return Box3d.createBoundingBox_Covariance((Box3d) s1, (Box3d) s2);
     case CAPSULE:
       return Capsule3d.createBoundingCapsule_MaxDist((Capsule3d) s1, (Capsule3d) s2);
     case RSS:
       return RSS3d.createBoundingRSS_covariance((RSS3d) s1, (RSS3d) s2);
     case PSS:
       return Sphere3d.createBoundingSphere((Sphere3d) s1, (Sphere3d) s2);
   }
   throw new Error("Unknown volume type chosen: " + chainTree.volumeMode);
 }
  /** Create a volume bounding all the points. Also extend the radius appropriately */
  Volume3d createEnclosingExtendedVolume(PointSet3d points, double extension) {
    switch (chainTree.volumeMode) {
      case OBB:
        Box3d retBox = Box3d.createBoundingBox_Covariance(points);
        retBox.extents[0] += extension;
        retBox.extents[1] += extension;
        retBox.extents[2] += extension;
        return retBox;
      case CAPSULE:
        Capsule3d ret = Capsule3d.createBoundingCapsule_CovarianceFit(points);
        ret.rad += extension;
        return ret;
      case RSS:
        RSS3d rss = RSS3d.createBoundingRSS_covariance(points);
        rss.radius += extension;

        return rss;
      case PSS:
        Sphere3d sphere = Sphere3d.getMinSphere(points);
        sphere.radius += extension;
        return sphere;
    }
    throw new Error("Unknown volume type chosen: " + chainTree.volumeMode);
  }