From dbc98deea1884e44da2c74d6ea807253cdefa693 Mon Sep 17 00:00:00 2001 From: Julien Gouesse Date: Sat, 28 Nov 2015 15:11:48 +0100 Subject: Relocate package prefix to org.jogamp.java3d --- src/javax/media/j3d/TriangleArrayRetained.java | 491 ------------------------- 1 file changed, 491 deletions(-) delete mode 100644 src/javax/media/j3d/TriangleArrayRetained.java (limited to 'src/javax/media/j3d/TriangleArrayRetained.java') diff --git a/src/javax/media/j3d/TriangleArrayRetained.java b/src/javax/media/j3d/TriangleArrayRetained.java deleted file mode 100644 index 810ea7d..0000000 --- a/src/javax/media/j3d/TriangleArrayRetained.java +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Sun designates this - * particular file as subject to the "Classpath" exception as provided - * by Sun in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - */ - -package javax.media.j3d; - -import javax.vecmath.Point3d; -import javax.vecmath.Vector3d; - -/** - * The TriangleArray object draws the array of vertices as individual - * triangles. Each group - * of three vertices defines a triangle to be drawn. - */ - -class TriangleArrayRetained extends GeometryArrayRetained { - - TriangleArrayRetained() { - this.geoType = GEO_TYPE_TRI_SET; - } - - @Override - boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, - GeometryRetained geom, int geomIndex) { - Point3d pnts[] = new Point3d[3]; - double sdist[] = new double[1]; - double minDist = Double.MAX_VALUE; - double x = 0, y = 0, z = 0; - int[] vtxIndexArr = new int[3]; - - int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? - initialVertexIndex : initialCoordIndex); - pnts[0] = new Point3d(); - pnts[1] = new Point3d(); - pnts[2] = new Point3d(); - - switch (pickShape.getPickType()) { - case PickShape.PICKRAY: - PickRay pickRay= (PickRay) pickShape; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectRay(pnts, pickRay, sdist, iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKSEGMENT: - PickSegment pickSegment = (PickSegment) pickShape; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectSegment(pnts, pickSegment.start, - pickSegment.end, sdist, iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKBOUNDINGBOX: - BoundingBox bbox = (BoundingBox) - ((PickBounds) pickShape).bounds; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectBoundingBox(pnts, bbox, sdist, iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKBOUNDINGSPHERE: - BoundingSphere bsphere = (BoundingSphere) - ((PickBounds) pickShape).bounds; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectBoundingSphere(pnts, bsphere, sdist, iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKBOUNDINGPOLYTOPE: - BoundingPolytope bpolytope = (BoundingPolytope) - ((PickBounds) pickShape).bounds; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectBoundingPolytope(pnts, bpolytope, - sdist,iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKCYLINDER: - PickCylinder pickCylinder= (PickCylinder) pickShape; - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectCylinder(pnts, pickCylinder, sdist, - iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKCONE: - PickCone pickCone= (PickCone) pickShape; - - while (i < validVertexCount) { - for(int j=0; j<3; j++) { - vtxIndexArr[j] = i; - getVertexData(i++, pnts[j]); - } - if (intersectCone(pnts, pickCone, sdist, iPnt)) { - if (flags == 0) { - return true; - } - if (sdist[0] < minDist) { - minDist = sdist[0]; - x = iPnt.x; - y = iPnt.y; - z = iPnt.z; - if((flags & PickInfo.CLOSEST_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - if((flags & PickInfo.ALL_GEOM_INFO) != 0) { - storeInterestData(pickInfo, flags, geom, geomIndex, - vtxIndexArr, iPnt, sdist[0]); - } - } - } - break; - case PickShape.PICKPOINT: - // Should not happen since API already check for this - throw new IllegalArgumentException(J3dI18N.getString("TriangleArrayRetained0")); - default: - throw new RuntimeException ("PickShape not supported for intersection"); - } - - - if (minDist < Double.MAX_VALUE) { - iPnt.x = x; - iPnt.y = y; - iPnt.z = z; - return true; - } - return false; - } - - - @Override - boolean intersect(Point3d[] pnts) { - Point3d[] points = new Point3d[3]; - double dist[] = new double[1]; - int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? - initialVertexIndex : initialCoordIndex); - - points[0] = new Point3d(); - points[1] = new Point3d(); - points[2] = new Point3d(); - - switch (pnts.length) { - case 3: // Triangle - while (i