https://bugs.kde.org/show_bug.cgi?id=430884

--- Comment #1 from Maurizio Paolini <paol...@dmf.unicatt.it> ---
There is an easy fix for this problem.  the isSingular function at the
end of misc/common.cpp should test whether a 2x2 matrix is (numerically)
singular.  Currently it does so by testing whether the determinant is small
relative to the product of the norm of the two row vectors, meaning that the
two rows are "nearly parallel" vectors.
However it seems that the two rows where assumed not to be zero (as 2D
vectors).
A quick fix is to change the '<' test into '<=', although here we should also
use some nunmerical threshold value.
Anyway, this at least should fix the NaN problem when drawing a circle through
3 coincident points.  The fix is in a piece of code that I wrote a long long
time ago, so it could be my responsibility to fix it.

diff --git a/misc/common.cpp b/misc/common.cpp
index b13349cd..d841cb62 100644
--- a/misc/common.cpp
+++ b/misc/common.cpp
@@ -489,8 +489,10 @@ bool isSingular( const double& a, const double& b,
 /*
  * test must be done relative to the magnitude of the two
  * row (or column) vectors!
+ *
+ * (2021_01_02: we also need to cover for the case where norm1 or norm2 is
numerically zero!)
  */
-  return ( std::fabs(det) < test_threshold*norm1*norm2 );
+  return ( std::fabs(det) <= test_threshold*norm1*norm2 );
 }

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to