// the bounds argument is already transformed
  @Override
  boolean intersect(Bounds targetBound) {
    int i = 0;
    int j, count = 0;
    Point3d[] pnts = new Point3d[2];
    int scount;
    pnts[0] = new Point3d();
    pnts[1] = new Point3d();

    switch (targetBound.getPickType()) {
      case PickShape.PICKBOUNDINGBOX:
        BoundingBox box = (BoundingBox) targetBound;

        while (i < stripIndexCounts.length) {
          getVertexData(indexCoord[count++], pnts[0]);
          scount = stripIndexCounts[i++];
          for (j = 1; j < scount; j++) {
            getVertexData(indexCoord[count++], pnts[1]);
            if (intersectBoundingBox(pnts, box, null, null)) {
              return true;
            }
            pnts[0].set(pnts[1]);
          }
        }
        break;
      case PickShape.PICKBOUNDINGSPHERE:
        BoundingSphere bsphere = (BoundingSphere) targetBound;

        while (i < stripIndexCounts.length) {
          getVertexData(indexCoord[count++], pnts[0]);
          scount = stripIndexCounts[i++];
          for (j = 1; j < scount; j++) {
            getVertexData(indexCoord[count++], pnts[1]);
            if (intersectBoundingSphere(pnts, bsphere, null, null)) {
              return true;
            }
            pnts[0].set(pnts[1]);
          }
        }
        break;
      case PickShape.PICKBOUNDINGPOLYTOPE:
        BoundingPolytope bpolytope = (BoundingPolytope) targetBound;

        while (i < stripIndexCounts.length) {
          getVertexData(indexCoord[count++], pnts[0]);
          scount = stripIndexCounts[i++];
          for (j = 1; j < scount; j++) {
            getVertexData(indexCoord[count++], pnts[1]);
            if (intersectBoundingPolytope(pnts, bpolytope, null, null)) {
              return true;
            }
            pnts[0].set(pnts[1]);
          }
        }
        break;
      default:
        throw new RuntimeException("Bounds not supported for intersection " + targetBound);
    }
    return false;
  }
예제 #2
0
  // the bounds argument is already transformed
  @Override
  boolean intersect(Bounds targetBound) {
    Point3d[] points = new Point3d[4];
    int i =
        ((vertexFormat & GeometryArray.BY_REFERENCE) == 0 ? initialVertexIndex : initialCoordIndex);

    points[0] = new Point3d();
    points[1] = new Point3d();
    points[2] = new Point3d();
    points[3] = new Point3d();

    switch (targetBound.getPickType()) {
      case PickShape.PICKBOUNDINGBOX:
        BoundingBox box = (BoundingBox) targetBound;

        while (i < validVertexCount) {
          getVertexData(i++, points[0]);
          getVertexData(i++, points[1]);
          getVertexData(i++, points[2]);
          getVertexData(i++, points[3]);
          if (intersectBoundingBox(points, box, null, null)) {
            return true;
          }
        }
        break;
      case PickShape.PICKBOUNDINGSPHERE:
        BoundingSphere bsphere = (BoundingSphere) targetBound;

        while (i < validVertexCount) {
          getVertexData(i++, points[0]);
          getVertexData(i++, points[1]);
          getVertexData(i++, points[2]);
          getVertexData(i++, points[3]);
          if (intersectBoundingSphere(points, bsphere, null, null)) {
            return true;
          }
        }
        break;
      case PickShape.PICKBOUNDINGPOLYTOPE:
        BoundingPolytope bpolytope = (BoundingPolytope) targetBound;

        while (i < validVertexCount) {
          getVertexData(i++, points[0]);
          getVertexData(i++, points[1]);
          getVertexData(i++, points[2]);
          getVertexData(i++, points[3]);
          if (intersectBoundingPolytope(points, bpolytope, null, null)) {
            return true;
          }
        }
        break;
      default:
        throw new RuntimeException("Bounds not supported for intersection " + targetBound);
    }
    return false;
  }
  // the bounds argument is already transformed
  @Override
  boolean intersect(Bounds targetBound) {
    Point3d[] pnts = new Point3d[3];
    // NVaidya
    // Bug 447: correction for loop indices
    int i = initialIndexIndex;
    int loopStopIndex = initialIndexIndex + validIndexCount;
    pnts[0] = new Point3d();
    pnts[1] = new Point3d();
    pnts[2] = new Point3d();

    switch (targetBound.getPickType()) {
      case PickShape.PICKBOUNDINGBOX:
        BoundingBox box = (BoundingBox) targetBound;

        while (i < loopStopIndex) {
          getVertexData(indexCoord[i++], pnts[0]);
          getVertexData(indexCoord[i++], pnts[1]);
          getVertexData(indexCoord[i++], pnts[2]);
          if (intersectBoundingBox(pnts, box, null, null)) {
            return true;
          }
        }
        break;
      case PickShape.PICKBOUNDINGSPHERE:
        BoundingSphere bsphere = (BoundingSphere) targetBound;

        while (i < loopStopIndex) {
          getVertexData(indexCoord[i++], pnts[0]);
          getVertexData(indexCoord[i++], pnts[1]);
          getVertexData(indexCoord[i++], pnts[1]);
          if (intersectBoundingSphere(pnts, bsphere, null, null)) {
            return true;
          }
        }
        break;
      case PickShape.PICKBOUNDINGPOLYTOPE:
        BoundingPolytope bpolytope = (BoundingPolytope) targetBound;

        while (i < loopStopIndex) {
          getVertexData(indexCoord[i++], pnts[0]);
          getVertexData(indexCoord[i++], pnts[1]);
          getVertexData(indexCoord[i++], pnts[2]);
          if (intersectBoundingPolytope(pnts, bpolytope, null, null)) {
            return true;
          }
        }
        break;
      default:
        throw new RuntimeException("Bounds not supported for intersection " + targetBound);
    }
    return false;
  }