summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--logic/tracker.cpp2
-rw-r--r--logic/tracker.h2
-rw-r--r--pose-widget/glwidget.cpp22
-rw-r--r--pose-widget/glwidget.h19
4 files changed, 27 insertions, 18 deletions
diff --git a/logic/tracker.cpp b/logic/tracker.cpp
index fd6ecfe7..448cb9de 100644
--- a/logic/tracker.cpp
+++ b/logic/tracker.cpp
@@ -25,6 +25,8 @@
# include <windows.h>
#endif
+using namespace euler;
+
constexpr double Tracker::r2d;
constexpr double Tracker::d2r;
diff --git a/logic/tracker.h b/logic/tracker.h
index 7588d76f..9230ef98 100644
--- a/logic/tracker.h
+++ b/logic/tracker.h
@@ -13,7 +13,7 @@
#include "compat/timer.hpp"
#include "api/plugin-support.hpp"
#include "mappings.hpp"
-#include "compat/simple-mat.hpp"
+#include "compat/euler.hpp"
#include "selected-libraries.hpp"
#include "spline-widget/spline.hpp"
diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp
index 7f24fa7a..01a6b74b 100644
--- a/pose-widget/glwidget.cpp
+++ b/pose-widget/glwidget.cpp
@@ -14,6 +14,9 @@
#include <QDebug>
+using namespace euler;
+using namespace impl;
+
GLWidget::GLWidget(QWidget *parent) : QWidget(parent)
{
Q_INIT_RESOURCE(posewidget);
@@ -54,19 +57,14 @@ void GLWidget::rotateBy(double xAngle, double yAngle, double zAngle, double x, d
}
class Triangle {
- using num = GLWidget::num;
- using vec2 = GLWidget::vec2;
- using vec3 = GLWidget::vec3;
+ num dot00, dot01, dot11, invDenom;
+ vec2 v0, v1, origin;
public:
Triangle(const vec2& p1, const vec2& p2, const vec2& p3);
bool barycentric_coords(const vec2& px, vec2& uv, int& i) const;
-
-private:
- num dot00, dot01, dot11, invDenom;
- vec2 v0, v1, origin;
};
-inline GLWidget::vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec3& p3)
+inline vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec3& p3)
{
using std::sqrt;
@@ -80,7 +78,7 @@ inline GLWidget::vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec
return tmp * i;
}
-Triangle::Triangle(const Triangle::vec2& p1, const Triangle::vec2& p2, const Triangle::vec2& p3)
+Triangle::Triangle(const vec2& p1, const vec2& p2, const vec2& p3)
{
using std::fabs;
@@ -107,7 +105,7 @@ Triangle::Triangle(const Triangle::vec2& p1, const Triangle::vec2& p2, const Tri
invDenom = 1 / denom;
}
-bool Triangle::barycentric_coords(const Triangle::vec2& px, Triangle::vec2& uv, int& i) const
+bool Triangle::barycentric_coords(const vec2& px, vec2& uv, int& i) const
{
i = 0;
const vec2 v2 = px - origin;
@@ -272,7 +270,7 @@ void GLWidget::project_quad_texture()
}
}
-GLWidget::vec2 GLWidget::project(const vec3 &point)
+vec2 GLWidget::project(const vec3 &point)
{
vec3 ret = rotation * point;
num z = std::max<num>(.75f, 1 + translation.z()/-60);
@@ -286,7 +284,7 @@ GLWidget::vec2 GLWidget::project(const vec3 &point)
return vec2(z * (ret.x() + x), z * (ret.y() + y));
}
-GLWidget::vec3 GLWidget::project2(const vec3 &point)
+vec3 GLWidget::project2(const vec3 &point)
{
return rotation * point;
}
diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h
index 013cc0d5..f98b4628 100644
--- a/pose-widget/glwidget.h
+++ b/pose-widget/glwidget.h
@@ -11,7 +11,7 @@
#include <QWidget>
#include <QPixmap>
#include "api/plugin-api.hpp"
-#include "compat/simple-mat.hpp"
+#include "compat/euler.hpp"
#ifdef BUILD_pose_widget
# define POSE_WIDGET_EXPORT Q_DECL_EXPORT
@@ -19,12 +19,17 @@
# define POSE_WIDGET_EXPORT Q_DECL_IMPORT
#endif
+namespace impl {
+
+using num = float;
+using vec3 = Mat<num, 3, 1>;
+using vec2 = Mat<num, 2, 1>;
+
+using namespace euler;
+
class POSE_WIDGET_EXPORT GLWidget : public QWidget
{
public:
- using num = float;
- using vec2 = Mat<num, 2, 1>;
- using vec3 = Mat<num, 3, 1>;
using rmat = Mat<num, 3, 3>;
GLWidget(QWidget *parent);
@@ -36,7 +41,7 @@ private:
vec2 project(const vec3& point);
vec3 project2(const vec3& point);
void project_quad_texture();
- static inline vec3 normal(const vec3& p1, const vec3& p2, const vec3& p3);
+ static vec3 normal(const vec3& p1, const vec3& p2, const vec3& p3);
rmat rotation;
vec3 translation;
@@ -44,3 +49,7 @@ private:
QImage back;
QImage image;
};
+
+}
+
+using impl::GLWidget;