From 382477c6229b9e8938de3bd669f70a4cbb1f4048 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 31 May 2024 17:10:19 -0700 Subject: [PATCH] Fix sin/cos fixed values --- libs/kimath/include/geometry/eda_angle.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/kimath/include/geometry/eda_angle.h b/libs/kimath/include/geometry/eda_angle.h index 912f42c6a6..474e5a01e2 100644 --- a/libs/kimath/include/geometry/eda_angle.h +++ b/libs/kimath/include/geometry/eda_angle.h @@ -174,6 +174,10 @@ public: if( test.m_value == 0.0 || test.m_value == 180.0 ) return 0.0; + else if( test.m_value == 45.0 || test.m_value == 135.0 ) + return M_SQRT1_2; // sqrt(2)/2 + else if( test.m_value == 225.0 || test.m_value == 315.0 ) + return -M_SQRT1_2; else if( test.m_value == 90.0 ) return 1.0; else if( test.m_value == 270.0 ) @@ -193,6 +197,10 @@ public: return -1.0; else if( test.m_value == 90.0 || test.m_value == 270.0 ) return 0.0; + else if( test.m_value == 45.0 || test.m_value == 315.0 ) + return M_SQRT1_2; // sqrt(2)/2 + else if( test.m_value == 135.0 || test.m_value == 225.0 ) + return -M_SQRT1_2; else return cos( AsRadians() ); }