pi is no longer a template

Sun, 26 Jun 2022 20:27:04 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 26 Jun 2022 20:27:04 +0300
changeset 261
6a875faebde2
parent 260
48c66a4b1fe5
child 262
dc33f8a707c4

pi is no longer a template

src/basics.h file | annotate | diff | comparison | revisions
src/ldrawalgorithm.h file | annotate | diff | comparison | revisions
--- a/src/basics.h	Sun Jun 26 20:26:09 2022 +0300
+++ b/src/basics.h	Sun Jun 26 20:27:04 2022 +0300
@@ -108,8 +108,7 @@
 	}
 }
 
-template<typename T = float>
-constexpr std::enable_if_t<std::is_floating_point_v<T>, T> pi = static_cast<T>(M_PIl);
+constexpr float pi = M_PIf;
 
 inline QSizeF sizeToSizeF(const QSize& size)
 {
--- a/src/ldrawalgorithm.h	Sun Jun 26 20:26:09 2022 +0300
+++ b/src/ldrawalgorithm.h	Sun Jun 26 20:27:04 2022 +0300
@@ -21,8 +21,8 @@
 
 	constexpr float circleAngle(unsigned int divisions, unsigned int i)
 	{
-		constexpr float ofs = 0.5 * pi<>;
-		float factor = -2.0f * pi<> / static_cast<float>(divisions);
+		constexpr float ofs = 0.5 * pi;
+		float factor = -2.0f * pi / static_cast<float>(divisions);
 		return static_cast<float>(i) * factor + ofs;
 	}
 

mercurial