/** * Computes the bounding sphere for this node, including its children. * This method is called by {@link #getBoundingSphere(boolean)} when this * node's bounding sphere is dirty. * <p> * If a finite bounding sphere is specified, then any infinite bounding * sphere is replaced by an empty bounding sphere, so that the returned * sphere is always finite. * <p> * Classes that extend this abstract base class should override this * implementation, which simply returns an empty or infinite bounding * sphere, depending on whether or not a finite sphere is requested. * @param finite true, to force bounding sphere to be finite. * @return the computed bounding sphere. */ protected BoundingSphere computeBoundingSphere(boolean finite) { return (finite)?BoundingSphere.empty():BoundingSphere.infinite(); }
/** * Computes the bounding sphere for this handle. * @param finite true, to force bounding sphere to be finite. * @return the bounding sphere. */ protected BoundingSphere computeBoundingSphere(boolean finite) { _boundingSphereChildren = super.computeBoundingSphere(true); return (finite)?BoundingSphere.empty():BoundingSphere.infinite(); }
/** * Computes the bounding sphere for this group, including its children. * @param finite true, to force bounding sphere to be finite. * @return the computed bounding sphere. */ protected BoundingSphere computeBoundingSphere(boolean finite) { if (countChildren()==1) { return _childList.get(0).getBoundingSphere(finite); } else { BoundingBox bb = new BoundingBox(); for (Node child : _childList) bb.expandBy(child.getBoundingSphere(finite)); if (bb.isEmpty()) return BoundingSphere.empty(); if (bb.isInfinite()) // should not happen if finite == true return BoundingSphere.infinite(); BoundingSphere bs = new BoundingSphere(bb.getCenter(),0.0); for (Node child : _childList) bs.expandRadiusBy(child.getBoundingSphere(finite)); return bs; } }