From dec09333a3c357cc72c52c5a9de9590cd001d721 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Mon, 27 Feb 2023 18:01:41 +0000 Subject: [PATCH] LibGfx: Add method to Matrix that determines if the matrix is invertible --- Userland/Libraries/LibGfx/Matrix.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibGfx/Matrix.h b/Userland/Libraries/LibGfx/Matrix.h index 4358489cd9..718b4d4aa6 100644 --- a/Userland/Libraries/LibGfx/Matrix.h +++ b/Userland/Libraries/LibGfx/Matrix.h @@ -223,6 +223,11 @@ public: return result; } + constexpr bool is_invertible() const + { + return determinant() != 0.0; + } + private: T m_elements[N][N]; };