if( boundsObject.boundId == BOUNDING_SPHERE ) { BoundingSphere sphere = new BoundingSphere((BoundingSphere)boundsObject); sphere.transform(matrix); this.set(sphere); } else if( boundsObject.boundId == BOUNDING_BOX){ BoundingBox box = new BoundingBox( (BoundingBox)boundsObject); box.transform(matrix); this.set(box); } else if(boundsObject.boundId == BOUNDING_POLYTOPE) { BoundingPolytope polytope = new BoundingPolytope( (BoundingPolytope)boundsObject); polytope.transform(matrix); this.set(polytope); } else { throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope5")); }
    public void transform( Transform3D matrix) {	if(boundsIsInfinite)	    return;		int i;	double invMag;	Transform3D invTrans = VirtualUniverse.mc.getTransform3D(matrix);		invTrans.invert(); 	invTrans.transpose();	for(i = 0; i < planes.length; i++){	    planes[i].x = planes[i].x * mag[i];	    planes[i].y = planes[i].y * mag[i];	    planes[i].z = planes[i].z * mag[i];	    planes[i].w = planes[i].w * mag[i];	    invTrans.transform( planes[i] ); 	}       	VirtualUniverse.mc.addToTransformFreeList(invTrans);		for(i=0;i<planes.length;i++) {	    // normalize the plane normals	    mag[i] = Math.sqrt(planes[i].x*planes[i].x + planes[i].y*planes[i].y +			       planes[i].z*planes[i].z);	    invMag = 1.0/mag[i];	    this.planes[i] = new Vector4d( planes[i].x*invMag, planes[i].y*invMag,					   planes[i].z*invMag, planes[i].w*invMag );	    	}		for (i=0; i < verts.length; i++) {	    matrix.transform(verts[i]);	}	    }