/** * Computes the bounds of multiple bounding volumes * * @param bv * @return */ public static BoundingBox computeUnionBound(List<BoundingVolume> bv) { BoundingBox bbox = new BoundingBox(); for (int i = 0; i < bv.size(); i++) { BoundingVolume vol = bv.get(i); bbox.mergeLocal(vol); } return bbox; }
/** * Compute bounds of a geomList * * @param list * @param transform * @return */ public static BoundingBox computeUnionBound(GeometryList list, Transform transform) { BoundingBox bbox = new BoundingBox(); for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); BoundingVolume newVol = vol.transform(transform); // Nehon : prevent NaN and infinity values to screw the final bounding box if (!Float.isNaN(newVol.getCenter().x) && !Float.isInfinite(newVol.getCenter().x)) { bbox.mergeLocal(newVol); } } return bbox; }
/** * Compute bounds of a geomList * * @param list * @param mat * @return */ public static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat) { BoundingBox bbox = new BoundingBox(); BoundingVolume store = null; for (int i = 0; i < list.size(); i++) { BoundingVolume vol = list.get(i).getWorldBound(); store = vol.clone().transform(mat, null); // Nehon : prevent NaN and infinity values to screw the final bounding box if (!Float.isNaN(store.getCenter().x) && !Float.isInfinite(store.getCenter().x)) { bbox.mergeLocal(store); } } return bbox; }