public boolean isSimilar(Vector2f other, float epsilon) {
        if (other == null) {
            return false;
        }
        if (Float.compare(Math.abs(other.x - x), epsilon) > 0) {
            return false;
        }
        if (Float.compare(Math.abs(other.y - y), epsilon) > 0) {
            return false;
        }
        return true;
    }
Tests for approximate equality with the specified vector, using the
specified tolerance. If {@code other} is null, false is returned. Either
way, the current instance is unaffected.

@param other the vector to compare (unaffected) or null for none
@param epsilon the tolerance for each component
@return true if both components are within tolerance, otherwise false
jme3-core/src/main/java/com/jme3/math/Vector2f.java