fixed build

Sat, 14 Dec 2019 23:00:01 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 14 Dec 2019 23:00:01 +0200
changeset 20
cef43609a374
parent 19
ed9685f44ab3
child 21
0133e565e072

fixed build

CMakeLists.txt file | annotate | diff | comparison | revisions
src/main.h file | annotate | diff | comparison | revisions
src/math.h file | annotate | diff | comparison | revisions
src/maths.h file | annotate | diff | comparison | revisions
src/types/boundingbox.cpp file | annotate | diff | comparison | revisions
src/types/boundingbox.h file | annotate | diff | comparison | revisions
src/vertex.cpp file | annotate | diff | comparison | revisions
src/vertex.h file | annotate | diff | comparison | revisions
--- a/CMakeLists.txt	Sat Dec 14 22:36:06 2019 +0200
+++ b/CMakeLists.txt	Sat Dec 14 23:00:01 2019 +0200
@@ -55,7 +55,7 @@
 	src/libraries.h
 	src/main.h
 	src/mainwindow.h
-	src/math.h
+	src/maths.h
 	src/matrix.h
 	src/model.h
 	src/modeleditcontext.h
--- a/src/main.h	Sat Dec 14 22:36:06 2019 +0200
+++ b/src/main.h	Sat Dec 14 23:00:01 2019 +0200
@@ -5,7 +5,7 @@
 #include <memory>
 #include "basics.h"
 #include "utility.h"
-#include "main.h"
+#include "maths.h"
 
 namespace settingGroups
 {
--- a/src/math.h	Sat Dec 14 22:36:06 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#pragma once
-#include <cmath>
-
-namespace math
-{
-	using std::abs;
-	using std::sqrt;
-	using std::sin;
-	using std::cos;
-	using std::tan;
-	using std::atan;
-	using std::atan2;
-	using std::acos;
-	using std::asin;
-	using std::exp;
-	using std::log;
-	using std::log10;
-	using std::hypot;
-	using std::min;
-	using std::max;
-	using std::floor;
-	using std::ceil;
-	using std::trunc;
-	using std::round;
-	template<typename T, typename... Rest>
-	auto hypot(T&& x, Rest&&... rest)
-	{
-		return math::hypot(x, math::hypot(rest...));
-	}
-	template<typename T, typename... Rest>
-	auto max(T&& x, Rest&&... rest)
-	{
-		return math::max(x, math::max(rest...));
-	}
-	template<typename T, typename... Rest>
-	auto min(T&& x, Rest&&... rest)
-	{
-		return math::min(x, math::min(rest...));
-	}
-	constexpr double infinity = std::numeric_limits<double>::infinity();
-	constexpr double pi = M_PIl;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/maths.h	Sat Dec 14 23:00:01 2019 +0200
@@ -0,0 +1,56 @@
+#pragma once
+#include <cmath>
+
+namespace math
+{
+	using std::abs;
+	using std::sqrt;
+	using std::sin;
+	using std::cos;
+	using std::tan;
+	using std::atan;
+	using std::atan2;
+	using std::acos;
+	using std::asin;
+	using std::exp;
+	using std::log;
+	using std::log10;
+	using std::hypot;
+	using std::floor;
+	using std::ceil;
+	using std::trunc;
+	using std::round;
+	template<typename T, typename... Rest>
+	inline auto hypot(T&& x, Rest&&... rest)
+	{
+		return math::hypot(x, math::hypot(rest...));
+	}
+	template<typename T, typename... Rest>
+	const T& max(const T& x, const T& y)
+	{
+		if (x > y)
+			return x;
+		else
+			return y;
+	}
+	template<typename T, typename... Rest>
+	const T& max(const T& x, const T& y, Rest&&... rest)
+	{
+		return math::max(x, math::max(y, rest...));
+	}
+	template<typename T, typename... Rest>
+	const T& min(const T& x, const T& y)
+	{
+		if (x < y)
+			return x;
+		else
+			return y;
+	}
+	template<typename T, typename... Rest>
+	const T& min(const T& x, const T& y, Rest&&... rest)
+	{
+		return math::min(x, math::min(y, rest...));
+	}
+	constexpr double infinity = std::numeric_limits<double>::infinity();
+	constexpr long double pi = M_PIl;
+}
--- a/src/types/boundingbox.cpp	Sat Dec 14 22:36:06 2019 +0200
+++ b/src/types/boundingbox.cpp	Sat Dec 14 23:00:01 2019 +0200
@@ -26,12 +26,12 @@
 
 void BoundingBox::consider(const Point3D& vertex)
 {
-	this->minimum.x = std::min(vertex.x, this->minimum.x);
-	this->minimum.y = std::min(vertex.y, this->minimum.y);
-	this->minimum.z = std::min(vertex.z, this->minimum.z);
-	this->maximum.x = std::max(vertex.x, this->maximum.x);
-	this->maximum.y = std::max(vertex.y, this->maximum.y);
-	this->maximum.z = std::max(vertex.z, this->maximum.z);
+	this->minimum.x = math::min(vertex.x, this->minimum.x);
+	this->minimum.y = math::min(vertex.y, this->minimum.y);
+	this->minimum.z = math::min(vertex.z, this->minimum.z);
+	this->maximum.x = math::max(vertex.x, this->maximum.x);
+	this->maximum.y = math::max(vertex.y, this->maximum.y);
+	this->maximum.z = math::max(vertex.z, this->maximum.z);
 }
 
 /*
@@ -64,5 +64,5 @@
  */
 double spaceDiagonal(const BoundingBox& box)
 {
-	return distance(box.minimum, box.maximum);
+	return math::distance(box.minimum, box.maximum);
 }
--- a/src/types/boundingbox.h	Sat Dec 14 22:36:06 2019 +0200
+++ b/src/types/boundingbox.h	Sat Dec 14 23:00:01 2019 +0200
@@ -18,7 +18,6 @@
 
 #pragma once
 #include "vertex.h"
-#include "math.h"
 
 class BoundingBox
 {
--- a/src/vertex.cpp	Sat Dec 14 22:36:06 2019 +0200
+++ b/src/vertex.cpp	Sat Dec 14 23:00:01 2019 +0200
@@ -61,6 +61,11 @@
 	}
 }
 
+Point3D::operator QVariant() const
+{
+	return QVariant::fromValue(*this);
+}
+
 void Point3D::assign(Axis axis, CoordinateType value)
 {
 	this->get(axis) = value;
--- a/src/vertex.h	Sat Dec 14 22:36:06 2019 +0200
+++ b/src/vertex.h	Sat Dec 14 23:00:01 2019 +0200
@@ -20,6 +20,7 @@
 #include <functional>
 #include <QVector3D>
 #include "basics.h"
+#include "maths.h"
 
 struct Point3D
 {
@@ -28,6 +29,7 @@
 	void assign(Axis axis, CoordinateType value);
 	CoordinateType& get(Axis ax);
 	CoordinateType get(Axis ax) const;
+	operator QVariant() const;
 };
 
 namespace math

mercurial