Esempio n. 1
0
 @Override
 public A get(int x, int y) {
   if ((x >= base.lowX() && x < base.highX()) && (y >= base.lowY() && y < base.highY())) {
     return base.get(x, y); // Its inside
   } else if ((x == base.lowX() - 1 || x == base.highX() + 1)
       && (y >= base.lowY() - 1 && y < base.highY() + 1)) {
     return pad; // Its immediate above or below
   } else if ((y == base.lowY() - 1 || y == base.highY() + 1)
       && (x >= base.lowX() - 1 && x < base.highX() + 1)) {
     return pad; // Its immediately left or right
   } else {
     return base.defaultValue();
   }
 }
Esempio n. 2
0
    /**
     * Build a single path from all of the contour parts.
     *
     * <p>May be disjoint and have holes (thus GeneralPath).
     *
     * @param classified The line-segment classifiers
     * @param isoDivided Original classification, used to disambiguate saddle conditions
     * @return Resulting contour
     */
    public static final GeneralPath assembleContours(
        Aggregates<MC_TYPE> classified, Aggregates<Boolean> isoDivided) {
      GeneralPath isoPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD);

      // Find an unambiguous case of an actual line, follow it around and build the line.
      // Stitching sets the line segments that have been "consumed" to MC_TYPE.empty, so segments
      // are only processed once.
      for (int x = classified.lowX(); x < classified.highX(); x++) {
        for (int y = classified.lowY(); y < classified.highY(); y++) {
          MC_TYPE type = classified.get(x, y);
          if (type != MC_TYPE.empty
              && type != MC_TYPE.surround
              && type != MC_TYPE.diag_one
              && type != MC_TYPE.diag_two) {
            stichContour(classified, isoDivided, isoPath, x, y);
          }
        }
      }
      return isoPath;
    }
Esempio n. 3
0
 @Override
 public int highY() {
   return base.highY();
 }
Esempio n. 4
0
 public int highY() {
   return base.highY() + 1;
 }