From 9161646a6ed0b84770c9645689b98b2d4a2dfb82 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 11 Aug 2015 06:35:43 +0200 Subject: pose-widget: don't pollute global namespace --- pose-widget/glwidget.cpp | 10 +++++----- pose-widget/glwidget.h | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 6da1948e..d6d5260e 100755 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -60,6 +60,8 @@ void GLWidget::rotateBy(float xAngle, float yAngle, float zAngle, float x, float class Triangle { using num = GLWidget::num; + using vec2 = GLWidget::vec2; + using vec3 = GLWidget::vec3; public: Triangle(const vec2& p1, const vec2& p2, @@ -89,10 +91,8 @@ private: vec2 v0, v1, origin; }; -static __inline vec3 normal(const vec3& p1, const vec3& p2, const vec3& p3) +inline GLWidget::vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec3& p3) { - using num = GLWidget::num; - vec3 u = p2 - p1; vec3 v = p3 - p1; @@ -194,7 +194,7 @@ void GLWidget::project_quad_texture() { this->texture = texture; } -vec2 GLWidget::project(const vec3 &point) +GLWidget::vec2 GLWidget::project(const vec3 &point) { vec3 ret = rotation * point; num z = std::max(.75, 1. + translation.z()/-60); @@ -208,7 +208,7 @@ vec2 GLWidget::project(const vec3 &point) return vec2 { z * (ret.x() + x), z * (ret.y() + y) }; } -vec3 GLWidget::project2(const vec3 &point) +GLWidget::vec3 GLWidget::project2(const vec3 &point) { return rotation * point; } diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h index aaea3e06..81517399 100755 --- a/pose-widget/glwidget.h +++ b/pose-widget/glwidget.h @@ -12,14 +12,14 @@ #include "opentrack/plugin-api.hpp" #include "opentrack/simple-mat.hpp" -typedef Mat vec2; -typedef Mat vec3; -typedef Mat rmat; - class GLWidget : public QWidget { public: using num = float; + using vec2 = Mat; + using vec3 = Mat; + using rmat = Mat; + GLWidget(QWidget *parent); ~GLWidget(); void rotateBy(float xAngle, float yAngle, float zAngle, float x, float y, float z); @@ -29,6 +29,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); rmat rotation; vec3 translation; QImage front; -- cgit v1.2.3