Beispiel #1
0
  private static final boolean isInside(Plane p, AABBox box) {
    final float[] low = box.getLow();
    final float[] high = box.getHigh();
    if (p.distanceTo(low[0], low[1], low[2]) > 0.0f) return (true);
    if (p.distanceTo(high[0], low[1], low[2]) > 0.0f) return (true);
    if (p.distanceTo(low[0], high[1], low[2]) > 0.0f) return (true);
    if (p.distanceTo(high[0], high[1], low[2]) > 0.0f) return (true);
    if (p.distanceTo(low[0], low[1], high[2]) > 0.0f) return (true);
    if (p.distanceTo(high[0], low[1], high[2]) > 0.0f) return (true);
    if (p.distanceTo(low[0], high[1], high[2]) > 0.0f) return (true);
    if (p.distanceTo(high[0], high[1], high[2]) > 0.0f) return (true);

    return (false);
  }
Beispiel #2
0
  @Override
  public float getStringHeight(CharSequence string, float pixelSize) {
    int height = 0;

    for (int i = 0; i < string.length(); i++) {
      char character = string.charAt(i);
      if (character != ' ') {
        Glyph glyph;
        try {
          glyph = getGlyph(character);
          AABBox bbox = glyph.getBBox(pixelSize);
          height = (int) Math.ceil(Math.max(bbox.getHeight(), height));
        } catch (FontException e) {
          logger.error(e.getMessage());
        }
      }
    }
    return height;
  }