diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-13 13:19:31 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-13 13:19:31 +0200 |
commit | 74d9f5e31428ef362033a63c10b781d943c5e5a5 (patch) | |
tree | 71e11ed620fa1d76577df07846e910970fe9210b /pose-widget | |
parent | 41a92ea7401c89c5696b3e1b2fa239458a92ff73 (diff) |
many: remove unneeded implicit type conversion double <-> float
Diffstat (limited to 'pose-widget')
-rw-r--r-- | pose-widget/glwidget.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
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<num>(.75, 1. + translation.z()/-60); + num z = std::max<num>(.75f, 1 + translation.z()/-60); int w = width(), h = height(); num x = w * translation.x() / 2 / -40; if (std::abs(x) > w/2) |