示例#1
0
  public int getSurfacePointIndexAndFraction(
      float cutoff,
      boolean isCutoffAbsolute,
      int x,
      int y,
      int z,
      Point3i offset,
      int vA,
      int vB,
      float valueA,
      float valueB,
      Point3f pointA,
      Vector3f edgeVector,
      boolean isContourType,
      float[] fReturn) {
    float thisValue =
        getSurfacePointAndFraction(
            cutoff,
            isCutoffAbsolute,
            valueA,
            valueB,
            pointA,
            edgeVector,
            x,
            y,
            z,
            vA,
            vB,
            fReturn,
            ptTemp);
    /*
     * from MarchingCubes
     *
     * In the case of a setup for a Marching Squares calculation,
     * we are collecting just the desired type of intersection for the 2D marching
     * square contouring -- x, y, or z. In the case of a contoured f(x,y) surface,
     * we take every point.
     *
     */

    if (marchingSquares != null && params.isContoured)
      return marchingSquares.addContourVertex(ptTemp, cutoff);
    int assocVertex =
        (assocCutoff > 0
            ? (fReturn[0] < assocCutoff
                ? vA
                : fReturn[0] > 1 - assocCutoff ? vB : MarchingSquares.CONTOUR_POINT)
            : MarchingSquares.CONTOUR_POINT);
    if (assocVertex >= 0) assocVertex = marchingCubes.getLinearOffset(x, y, z, assocVertex);
    int n = addVertexCopy(ptTemp, thisValue, assocVertex);
    if (n >= 0 && params.iAddGridPoints) {
      marchingCubes.calcVertexPoint(x, y, z, vB, ptTemp);
      addVertexCopy(valueA < valueB ? pointA : ptTemp, Float.NaN, MarchingSquares.EDGE_POINT);
      addVertexCopy(valueA < valueB ? ptTemp : pointA, Float.NaN, MarchingSquares.EDGE_POINT);
    }
    return n;
  }