if( boundsObject == null )  { boundsIsEmpty = true; boundsIsInfinite = false; initEmptyPolytope(); computeAllVerts(); return;
int i; double invMag; this.planes = new Vector4d[planes.length]; mag = new double[planes.length]; pDotN  = new double[planes.length];  for(i=0;i<planes.length;i++) {   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 );
    public BoundingPolytope(Bounds boundsObject ) {	int i;	boundId = BOUNDING_POLYTOPE;	if( boundsObject == null )  {	    boundsIsEmpty = true;	    boundsIsInfinite = false;	    initEmptyPolytope();	    computeAllVerts(); // TODO lazy evaluate	    return;	}       	boundsIsEmpty = boundsObject.boundsIsEmpty;	boundsIsInfinite = boundsObject.boundsIsInfinite;	if( boundsObject.boundId == BOUNDING_SPHERE ) {	    BoundingSphere sphere = (BoundingSphere)boundsObject;	    planes = new Vector4d[6];	    mag = new double[planes.length];	    pDotN  = new double[planes.length];	   	    planes[0] = new Vector4d( 1.0, 0.0, 0.0, -(sphere.center.x+sphere.radius) );	    planes[1] = new Vector4d(-1.0, 0.0, 0.0,   sphere.center.x-sphere.radius );	    planes[2] = new Vector4d( 0.0, 1.0, 0.0, -(sphere.center.y+sphere.radius) );	    planes[3] = new Vector4d( 0.0,-1.0, 0.0,   sphere.center.y-sphere.radius );	    planes[4] = new Vector4d( 0.0, 0.0, 1.0, -(sphere.center.z+sphere.radius) );	    planes[5] = new Vector4d( 0.0, 0.0,-1.0,   sphere.center.z-sphere.radius );	    mag[0] = 1.0;	    mag[1] = 1.0;	    mag[2] = 1.0;	    mag[3] = 1.0;	    mag[4] = 1.0;	    mag[5] = 1.0;	    computeAllVerts(); // TODO lazy evaluate	   	} else if( boundsObject.boundId == BOUNDING_BOX ){	    BoundingBox box = (BoundingBox)boundsObject;	    planes = new Vector4d[6];	    pDotN  = new double[planes.length];	    mag = new double[planes.length];	   	    planes[0] = new Vector4d( 1.0, 0.0, 0.0, -box.upper.x );	    planes[1] = new Vector4d(-1.0, 0.0, 0.0,  box.lower.x );	    planes[2] = new Vector4d( 0.0, 1.0, 0.0, -box.upper.y );	    planes[3] = new Vector4d( 0.0,-1.0, 0.0,  box.lower.y );	    planes[4] = new Vector4d( 0.0, 0.0, 1.0, -box.upper.z );	    planes[5] = new Vector4d( 0.0, 0.0,-1.0,  box.lower.z );	    mag[0] = 1.0;	    mag[1] = 1.0;	    mag[2] = 1.0;	    mag[3] = 1.0;	    mag[4] = 1.0;	    mag[5] = 1.0;	    computeAllVerts(); // TODO lazy evaluate	   	} else if( boundsObject.boundId == BOUNDING_POLYTOPE ) {	    BoundingPolytope polytope = (BoundingPolytope)boundsObject;	    planes = new Vector4d[polytope.planes.length];	    mag = new double[planes.length];	    pDotN  = new double[planes.length];	    nVerts = polytope.nVerts;	    verts  = new Point3d[nVerts];  	    for(i=0;i<planes.length;i++) {		planes[i] = new Vector4d(polytope.planes[i]);		mag[i] = polytope.mag[i];		pDotN[i] = polytope.pDotN[i];	    }	    for(i=0;i<verts.length;i++) {		verts[i] = new Point3d(polytope.verts[i]);	    }	    centroid = polytope.centroid;	} else {	    throw new IllegalArgumentException(J3dI18N.getString("BoundingPolytope0"));	}    }