summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_posewidget/glwidget.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-11-02 06:04:05 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-11-02 06:04:05 +0100
commitc044ce0d0830902b9ca86dcd9a725e5ef4f72eb1 (patch)
tree30283eea8cbc4d73ee85440f1e1858ea276e5245 /ftnoir_posewidget/glwidget.cpp
parent69dc9c96a1f544857d3909dd0412515840d544ca (diff)
use quaternions for centering
@KyokushinPL says was the only version that worked. Let's give it a try. Goddamn issue: #63
Diffstat (limited to 'ftnoir_posewidget/glwidget.cpp')
-rw-r--r--ftnoir_posewidget/glwidget.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/ftnoir_posewidget/glwidget.cpp b/ftnoir_posewidget/glwidget.cpp
index bfb9190d..07445c8a 100644
--- a/ftnoir_posewidget/glwidget.cpp
+++ b/ftnoir_posewidget/glwidget.cpp
@@ -34,26 +34,17 @@ void GLWidget::paintEvent ( QPaintEvent * event ) {
void GLWidget::rotateBy(double xAngle, double yAngle, double zAngle)
{
- double c1 = cos(zAngle / 57.295781);
- double s1 = sin(zAngle / 57.295781);
+ double c1 = cos(yAngle / 57.295781);
+ double s1 = sin(yAngle / 57.295781);
double c2 = cos(xAngle / 57.295781);
double s2 = sin(xAngle / 57.295781);
- double c3 = cos(yAngle / 57.295781);
- double s3 = sin(yAngle / 57.295781);
+ double c3 = cos(zAngle / 57.295781);
+ double s3 = sin(zAngle / 57.295781);
double foo[] = {
- // z
- c1 * c2,
- c1 * s2 * s3 - c3 * s1,
- s1 * s3 + c1 * c3 * s2,
- // y
- c2 * s1,
- c1 * c3 + s1 * s2 * s3,
- c3 * s1 * s2 - c1 * s3,
- // x
- -s2,
- c2 * s3,
- c2 * c3
+ c2*c3, -c2*s3, s2,
+ c1*s3+c3*s1*s2, c1*c3-s1*s2*s3, -c2*s1,
+ s1*s3-c1*c3*s2, c3*s1+c1*s2*s3, c1*c2,
};
for (int i = 0; i < 9; i++)