diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index 7cc5d4990c..c62f7c4dde 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -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; } diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index 6191d1aa7f..49f2d30079 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -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; }