Exemple #1
0
  public HeightEvent poll() {
    currentCoHeighted = null; // now working at a new height

    HeightEvent next = nextEvent();

    if (next instanceof EdgeCollision) {
      List<EdgeCollision> coHeighted = new ArrayList<EdgeCollision>();
      EdgeCollision ec = (EdgeCollision) next;
      coHeighted.add(ec);

      double height = ec.getHeight();

      for (; ; ) {
        EdgeCollision higher = faceEvents.peek();
        if (higher == null) break;
        if (higher.getHeight() - height < 0.00001) // ephemeral random
        // constant #34 was
        // 0.00001
        {
          faceEvents.poll(); // same as higher

          if (skel.seen.contains(higher)) continue;

          height = higher.getHeight();
          skel.seen.add(higher);
          coHeighted.add(higher);
        } else break;
      }

      return currentCoHeighted = new HeightCollision(coHeighted);
    } else return next;
  }
Exemple #2
0
  private HeightEvent nextEvent() {
    EdgeCollision ec;

    for (; ; ) {
      ec = faceEvents.poll();
      if (ec == null) break;
      // valid if we haven't seen it, and it's height is "greater" than
      // the current skeleton height
      if (!skel.seen.contains(ec) && ec.loc.z - skel.height > -0.001) break;
    }

    HeightEvent he = miscEvents.peek();

    if (ec == null) {
      return miscEvents.poll(); // might be null!
    }
    if (he == null) {
      skel.seen.add(ec);
      return ec; // might be null!
    }

    if (he.getHeight() <= ec.getHeight()) {
      faceEvents.add(ec);
      return miscEvents.poll(); // return he
    } else {
      skel.seen.add(ec);
      return ec; // return ec
    }
  }