⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 geometryarrayretained.java

📁 JAVA3D矩陈的相关类
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	    } else if((vertexType & PF) != 0) {		computeBoundingBox(floatBufferRefCoords);	    } else if((vertexType & PD) != 0) {		computeBoundingBox(doubleBufferRefCoords);	    }	    	} else if ((vertexFormat & GeometryArray.INTERLEAVED) != 0) {	    //System.err.println("vertexFormat & GeometryArray.INTERLEAVED");	    computeBoundingBox(initialCoordIndex, interLeavedVertexData);	} else if ((vertexType & PF) != 0) {	    //System.err.println("vertexType & PF");	    computeBoundingBox(floatRefCoords);	} else if ((vertexType & P3F) != 0) {	    //System.err.println("vertexType & P3F");	    computeBoundingBox(p3fRefCoords);	} else if ((vertexType & P3D) != 0) {	    //System.err.println("vertexType & P3D");	    computeBoundingBox(p3dRefCoords);	} else if ((vertexType & PD) != 0) {	    //System.err.println("vertexType & PD");	    computeBoundingBox(doubleRefCoords);	}            }    // NullGeometry is true only for byRef case    void processCoordsChanged(boolean nullGeo) {		/*	  System.err.println("processCoordsChanged : nullGeo " + nullGeo);	  System.err.println("Before :processCoordsChanged : geoBounds ");	  System.err.println(geoBounds);	*/	if (nullGeo) {	    synchronized(geoBounds) {		geoBounds.setLower(-1.0, -1.0, -1.0);		geoBounds.setUpper(1.0, 1.0, 1.0);		boundsDirty = false;	    }	    synchronized(centroid) {		recompCentroid = false;		this.centroid.set(geoBounds.getCenter());	    }	}	else {	    // re-compute centroid if used 	    synchronized(centroid) {		recompCentroid = true;	    }	    	    synchronized(geoBounds) {		boundsDirty = true;		computeBoundingBox();	    }	   	    /*	      System.err.println("After :processCoordsChanged : geoBounds ");	      System.err.println(geoBounds);	    */	}    }        void computeBoundingBox(int vIndex, float[] vdata) {	int i, offset;	double xmin, xmax, ymin, ymax, zmin, zmax;	//System.err.println("Before : computeBoundingBox : geoBounds ");	//  System.err.println(geoBounds);	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    // It is possible that user call getBounds() before	    // this Geometry add to live scene graph.	    if ((computeGeoBounds == 0) && (refCount > 0)) {	    	return;	    }	    if (!boundsDirty)		return;	    // Initial offset	    offset = vIndex * stride+coordinateOffset;	    // Compute the bounding box	    xmin = xmax = vdata[offset];	    ymin = ymax = vdata[offset+1];	    zmin = zmax = vdata[offset+2];	    offset += stride;	    for (i=1; i<validVertexCount; i++) {		if (vdata[offset] > xmax)		    xmax = vdata[offset];		if (vdata[offset] < xmin)		    xmin = vdata[offset];      		if (vdata[offset+1] > ymax)		    ymax = vdata[offset+1];		if (vdata[offset+1] < ymin)		    ymin = vdata[offset+1];   		if (vdata[offset+2] > zmax)		    zmax = vdata[offset+2];		if (vdata[offset+2] < zmin)		    zmin = vdata[offset+2];      		offset += stride;	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}	/*	  System.err.println("After : computeBoundingBox : geoBounds ");	  System.err.println(geoBounds);	*/	    }    // Compute boundingbox for interleaved nio buffer    void computeBoundingBox(int vIndex,   FloatBufferWrapper vdata) {	int i, offset;	double xmin, xmax, ymin, ymax, zmin, zmax;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	    // Initial offset	    	    offset = vIndex * stride+coordinateOffset;	    // Compute the bounding box	    xmin = xmax = vdata.get(offset);	    ymin = ymax = vdata.get(offset+1);	    zmin = zmax = vdata.get(offset+2);	    offset += stride;	    for (i=1; i<validVertexCount; i++) {		if (vdata.get(offset) > xmax)		    xmax = vdata.get(offset);		if (vdata.get(offset) < xmin)		    xmin = vdata.get(offset);      		if (vdata.get(offset+1) > ymax)		    ymax = vdata.get(offset+1);		if (vdata.get(offset+1) < ymin)		    ymin = vdata.get(offset+1);   		if (vdata.get(offset+2) > zmax)		    zmax = vdata.get(offset+2);		if (vdata.get(offset+2) < zmin)		    zmin = vdata.get(offset+2);      		offset += stride;	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }    // compute bounding box for coord with noi buffer    void computeBoundingBox( DoubleBufferWrapper buffer) {	int i, j, k, sIndex;	double xmin, xmax, ymin, ymax, zmin, zmax;		synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty) 		return;	    	    sIndex = initialCoordIndex;	    int maxIndex = 3*validVertexCount;	    // Compute the bounding box	    xmin = xmax = buffer.get(sIndex++);	    ymin = ymax = buffer.get(sIndex++);	    zmin = zmax = buffer.get(sIndex++);		    for (i=sIndex; i<maxIndex; i+=3) {		j = i + 1;		k = i + 2;				if (buffer.get(i) > xmax)		    xmax = buffer.get(i);		if (buffer.get(i) < xmin)		    xmin = buffer.get(i);	    		if (buffer.get(j) > ymax)		    ymax = buffer.get(j);		if (buffer.get(j) < ymin)		    ymin = buffer.get(j);   		if (buffer.get(k) > zmax)		    zmax = buffer.get(k);		if (buffer.get(k) < zmin)		    zmin = buffer.get(k);      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }    // compute bounding box for coord with noi buffer    void computeBoundingBox( FloatBufferWrapper buffer) {	int i, j, k, sIndex;	double xmin, xmax, ymin, ymax, zmin, zmax;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	    sIndex = initialCoordIndex;	    int maxIndex = 3*validVertexCount;	    // Compute the bounding box	    xmin = xmax = buffer.get(sIndex++);	    ymin = ymax = buffer.get(sIndex++);	    zmin = zmax = buffer.get(sIndex++);		    for (i=sIndex; i<maxIndex; i+=3) {		j = i + 1;		k = i + 2;				if (buffer.get(i) > xmax)		    xmax = buffer.get(i);		if (buffer.get(i) < xmin)		    xmin = buffer.get(i);	    		if (buffer.get(j) > ymax)		    ymax = buffer.get(j);		if (buffer.get(j) < ymin)		    ymin = buffer.get(j);   		if (buffer.get(k) > zmax)		    zmax = buffer.get(k);		if (buffer.get(k) < zmin)		    zmin = buffer.get(k);      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }    void computeBoundingBox(float[] coords) {	// System.err.println("GeometryArrayRetained : computeBoundingBox(float[] coords)"); 	int i, j, k, sIndex;	double xmin, xmax, ymin, ymax, zmin, zmax;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	    sIndex = initialCoordIndex;	    int maxIndex = 3*validVertexCount;		// Compute the bounding box	    xmin = xmax = coords[sIndex++];	    ymin = ymax = coords[sIndex++];	    zmin = zmax = coords[sIndex++];		    for (i=sIndex; i<maxIndex; i+=3) {		j = i + 1;		k = i + 2;				if (coords[i] > xmax)		    xmax = coords[i];		if (coords[i] < xmin)		    xmin = coords[i];	    		if (coords[j] > ymax)		    ymax = coords[j];		if (coords[j] < ymin)		    ymin = coords[j];   		if (coords[k] > zmax)		    zmax = coords[k];		if (coords[k] < zmin)		    zmin = coords[k];      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    // System.err.println("max(" + xmax + ", " + ymax + ", " + zmax + ")"); 	    geoBounds.setLower(xmin, ymin, zmin);	    // System.err.println("min(" + xmin + ", " + ymin + ", " + zmin + ")"); 	    boundsDirty = false; 	}    }    void computeBoundingBox(double[] coords) {	int i, j, k, sIndex;	double xmin, xmax, ymin, ymax, zmin, zmax;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	    sIndex = initialCoordIndex;	    int maxIndex = 3*validVertexCount;	    	    // Compute the bounding box	    xmin = xmax = coords[sIndex++];	    ymin = ymax = coords[sIndex++];	    zmin = zmax = coords[sIndex++];		    for (i=sIndex; i<maxIndex; i+=3) {		j = i + 1;		k = i + 2;				if (coords[i] > xmax)		    xmax = coords[i];		if (coords[i] < xmin)		    xmin = coords[i];	    		if (coords[j] > ymax)		    ymax = coords[j];		if (coords[j] < ymin)		    ymin = coords[j];   		if (coords[k] > zmax)		    zmax = coords[k];		if (coords[k] < zmin)		    zmin = coords[k];      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }    void computeBoundingBox(Point3f[] coords) {    	double xmin, xmax, ymin, ymax, zmin, zmax;	Point3f p;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	// Compute the bounding box	    xmin = xmax = coords[initialCoordIndex].x;	    ymin = ymax = coords[initialCoordIndex].y;	    zmin = zmax = coords[initialCoordIndex].z;	    for (int i=initialCoordIndex+1; i<validVertexCount; i++) {		p = coords[i];		if (p.x > xmax) xmax = p.x;		if (p.x < xmin) xmin = p.x;      		if (p.y > ymax) ymax = p.y;		if (p.y < ymin) ymin = p.y;   		if (p.z > zmax) zmax = p.z;		if (p.z < zmin) zmin = p.z;      	    }	    geoBounds.setUpper(xmax, ymax, zmax);	    geoBounds.setLower(xmin, ymin, zmin);	    boundsDirty = false; 	}    }    void computeBoundingBox(Point3d[] coords) {    	double xmin, xmax, ymin, ymax, zmin, zmax;	Point3d p;	synchronized(geoBounds) {	    // If autobounds compute is false  then return	    if ((computeGeoBounds == 0) && (refCount > 0)) {		return;	    }	    if (!boundsDirty)		return;	// Compute the bounding box	    xmin = xmax = coords[initialCoordIndex].x;	    ymin = ymax = coords[initialCoordIndex].y;	    zmin = zmax = coords[initialCoordIndex].z;	    for (int i=initialCoordIndex+1; i<validVertexCount; i++) {		p = coords[i];		if (p.x > xmax) xmax = p.x;		if (p.x < xmin) xmin = p.x;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -