aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-14 16:40:53 +0200
committerAdrian Kummerlaender2019-09-14 16:40:53 +0200
commit36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0 (patch)
tree1b29e874a1a6d08ed63c42a470696d262ee8fe91
parent7dd8c26d36b412c1a21125fc763960c78ec16580 (diff)
downloadsymlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar.gz
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar.bz2
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar.lz
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar.xz
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.tar.zst
symlbm_playground-36bf34e62fbaa7591ed32902cc9e3c08a4f7edc0.zip
Fix rotation
-rw-r--r--ldc_3d_gl_interop.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/ldc_3d_gl_interop.py b/ldc_3d_gl_interop.py
index cccc610..22bcd71 100644
--- a/ldc_3d_gl_interop.py
+++ b/ldc_3d_gl_interop.py
@@ -66,7 +66,7 @@ def get_projection(width, height):
return numpy.matmul(look, projection), point_size
class Rotation:
- def __init__(self, shift, x = 0.0, z = 0.0):
+ def __init__(self, shift, x = numpy.pi, z = numpy.pi):
self.shift = shift
self.rotation_x = x
self.rotation_z = z
@@ -76,8 +76,8 @@ class Rotation:
self.rotation_z += z
def get(self):
- qx = quaternion.Quaternion(quaternion.create(1,0,0,self.rotation_x))
- qz = quaternion.Quaternion(quaternion.create(0,0,1,self.rotation_z))
+ qx = quaternion.Quaternion(quaternion.create_from_eulers([self.rotation_x,0,0]))
+ qz = quaternion.Quaternion(quaternion.create_from_eulers([0,0,self.rotation_z]))
rotation = qz.cross(qx)
return numpy.matmul(
matrix44.create_from_translation(self.shift),
@@ -244,12 +244,12 @@ def on_keyboard(key, x, y):
global rotation
x = {
- b'w': -numpy.pi/100,
- b's': numpy.pi/100
+ b'w': numpy.pi/10,
+ b's': -numpy.pi/10
}.get(key, 0.0)
z = {
- b'a': -numpy.pi/100,
- b'd': numpy.pi/100
+ b'a': numpy.pi/10,
+ b'd': -numpy.pi/10
}.get(key, 0.0)
rotation.update(x,z)