/** * Gets the point at the center of this box. * @return the box center. */ public Point3 getCenter() { Check.state(!isEmpty(),"bounding box is not empty"); Check.state(!isInfinite(),"bounding box is not infinite"); return (isInfinite()) ? new Point3(0.0,0.0,0.0) : new Point3(0.5*(_xmin+_xmax),0.5*(_ymin+_ymax),0.5*(_zmin+_zmax)); }
if (!bb.isInfinite()) { if (!bb.isEmpty()) { Point3 pmin = bb.getMin();
if (!bb.isInfinite()) { if (!bb.isEmpty()) { Point3 pmin = bb.getMin();
/** * 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; } }