From 74d9f5e31428ef362033a63c10b781d943c5e5a5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 13 May 2016 13:19:31 +0200 Subject: many: remove unneeded implicit type conversion double <-> float --- pose-widget/glwidget.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'pose-widget') diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 1b30e585..a2ed422e 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -34,13 +34,15 @@ void GLWidget::paintEvent ( QPaintEvent * event ) { void GLWidget::rotateBy(float xAngle, float yAngle, float zAngle, float x, float y, float z) { + using std::sin; + using std::cos; - float c1 = cos(yAngle / 57.295781); - float s1 = sin(yAngle / 57.295781); - float c2 = cos(xAngle / 57.295781); - float s2 = sin(xAngle / 57.295781); - float c3 = cos(zAngle / 57.295781); - float s3 = sin(zAngle / 57.295781); + float c1 = cos(yAngle / 57.295781f); + float s1 = sin(yAngle / 57.295781f); + float c2 = cos(xAngle / 57.295781f); + float s2 = sin(xAngle / 57.295781f); + float c3 = cos(zAngle / 57.295781f); + float s3 = sin(zAngle / 57.295781f); rotation = rmat(c2*c3, -c2*s3, s2, c1*s3+c3*s1*s2, c1*c3-s1*s2*s3, -c2*s1, @@ -86,12 +88,14 @@ private: inline GLWidget::vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec3& p3) { + using std::sqrt; + vec3 u = p2 - p1; vec3 v = p3 - p1; vec3 tmp = u.cross(v); - num i = 1./sqrt(tmp.dot(tmp)); + num i = 1/sqrt(tmp.dot(tmp)); return tmp * i; } @@ -199,7 +203,7 @@ void GLWidget::project_quad_texture() { const unsigned char r___ = orig[orig_pos___ + 2]; const unsigned char g___ = orig[orig_pos___ + 1]; const unsigned char b___ = orig[orig_pos___ + 0]; - + const unsigned char a1 = orig[orig_pos + 3]; const unsigned char a2 = orig[orig_pos_ + 3]; const unsigned char a3 = orig[orig_pos__ + 3]; @@ -224,7 +228,7 @@ void GLWidget::project_quad_texture() { GLWidget::vec2 GLWidget::project(const vec3 &point) { vec3 ret = rotation * point; - num z = std::max(.75, 1. + translation.z()/-60); + num z = std::max(.75f, 1 + translation.z()/-60); int w = width(), h = height(); num x = w * translation.x() / 2 / -40; if (std::abs(x) > w/2) -- cgit v1.2.3