getVertexData(i++, pnts[0]); getVertexData(i++, pnts[1]); getVertexData(i++, pnts[2]); getVertexData(i++, pnts[3]); count += 4;
for(int j=0; j<4; j++) { vtxIndexArr[j] = i; getVertexData(i++, pnts[j]); }
    boolean intersect(PickShape pickShape, PickInfo.IntersectionInfo iInfo,  int flags, Point3d iPnt) {	Point3d pnts[] = new Point3d[4];	double sdist[] = new double[1];	double minDist = Double.MAX_VALUE;	double x = 0, y = 0, z = 0;        int count = 0;        int minICount = 0; 	int i = ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ?		 initialVertexIndex : initialCoordIndex);	pnts[0] = new Point3d();	pnts[1] = new Point3d();	pnts[2] = new Point3d();	pnts[3] = new Point3d();    	switch (pickShape.getPickType()) {	case PickShape.PICKRAY:	    PickRay pickRay= (PickRay) pickShape;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectRay(pnts, pickRay, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKSEGMENT:	    PickSegment pickSegment = (PickSegment) pickShape;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectSegment(pnts, pickSegment.start,				     pickSegment.end, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKBOUNDINGBOX:	    BoundingBox bbox = (BoundingBox) 		               ((PickBounds) pickShape).bounds;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectBoundingBox(pnts, bbox, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKBOUNDINGSPHERE:	    BoundingSphere bsphere = (BoundingSphere) 		                     ((PickBounds) pickShape).bounds;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectBoundingSphere(pnts, bsphere, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKBOUNDINGPOLYTOPE:	    BoundingPolytope bpolytope = (BoundingPolytope) 		                      ((PickBounds) pickShape).bounds;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectBoundingPolytope(pnts, bpolytope, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKCYLINDER:	    PickCylinder pickCylinder= (PickCylinder) pickShape;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectCylinder(pnts, pickCylinder, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKCONE:	    PickCone pickCone= (PickCone) pickShape;	    while (i < validVertexCount) {		getVertexData(i++, pnts[0]);		getVertexData(i++, pnts[1]);		getVertexData(i++, pnts[2]);		getVertexData(i++, pnts[3]);                count += 4;		if (intersectCone(pnts, pickCone, sdist, iPnt)) {		    if (flags == 0) {			return true;		    }		    if (sdist[0] < minDist) {			minDist = sdist[0];                        minICount = count;			x = iPnt.x;			y = iPnt.y;			z = iPnt.z;		    }		}	    }	    break;	case PickShape.PICKPOINT:	    // Should not happen since API already check for this	    throw new IllegalArgumentException(J3dI18N.getString("QuadArrayRetained0"));	default:	    throw new RuntimeException("PickShape not supported for intersection "); 	} 	if (minDist < Double.MAX_VALUE) {            assert(minICount >= 4);            int[] vertexIndices = iInfo.getVertexIndices();            if (vertexIndices == null) {                vertexIndices = new int[4];                iInfo.setVertexIndices(vertexIndices);            }            vertexIndices[0] = minICount - 4;            vertexIndices[1] = minICount - 3;            vertexIndices[2] = minICount - 2;            vertexIndices[3] = minICount - 1;	    iPnt.x = x;	    iPnt.y = y;	    iPnt.z = z;	    return true;	}	return false;       }