1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added isFinite() methods to Point and Rectangle.

This commit is contained in:
jules 2015-04-01 11:58:05 +01:00
parent 5ce5d95064
commit 769c2f4b46
2 changed files with 6 additions and 0 deletions

View file

@ -58,6 +58,9 @@ public:
/** Returns true if the point is (0, 0). */
bool isOrigin() const noexcept { return x == ValueType() && y == ValueType(); }
/** Returns true if the coordinates are finite values. */
inline bool isFinite() const noexcept { return juce_isfinite(x) && juce_isfinite(y); }
/** Returns the point's x coordinate. */
inline ValueType getX() const noexcept { return x; }

View file

@ -100,6 +100,9 @@ public:
/** Returns true if the rectangle's width or height are zero or less */
bool isEmpty() const noexcept { return w <= ValueType() || h <= ValueType(); }
/** Returns true if the rectangle's values are all finite numbers, i.e. not NaN or infinity. */
inline bool isFinite() const noexcept { return pos.isFinite() && juce_isfinite(w) && juce_isfinite(h); }
/** Returns the x coordinate of the rectangle's left-hand-side. */
inline ValueType getX() const noexcept { return pos.x; }