Example #1
0
  private boolean distanceOK(GeoPoint2 Q) {
    boolean distanceOK;

    if (lastFarAway && isFarAway(Q.inhomX, Q.inhomY)) {
      // if last point Q' was far away and Q is far away
      // then the distance is probably OK (return true),
      // so we probably don't need smaller step,
      // except if the rectangle of the segment Q'Q
      // intersects the near to screen rectangle
      // (it will probably not be on the screen anyway)
      double minX = lastX;
      double minY = lastY;
      double lengthX = Q.inhomX - lastX;
      double lengthY = Q.inhomY - lastY;
      if (Q.inhomX < minX) minX = Q.inhomX;
      if (Q.inhomY < minY) minY = Q.inhomY;
      if (lengthX < 0) lengthX = -lengthX;
      if (lengthY < 0) lengthY = -lengthY;
      distanceOK = !nearToScreenRect.intersects(minX, minY, lengthX, lengthY);
    } else {
      distanceOK = distanceSmall(Q);
    }

    return distanceOK;
  }