[Mud-builder-commits] r281 - trunk/packages/horizon.pkg

jaffa at garage.maemo.org jaffa at garage.maemo.org
Wed Jul 29 23:39:04 EEST 2009


Author: jaffa
Date: 2009-07-29 23:39:03 +0300 (Wed, 29 Jul 2009)
New Revision: 281

Modified:
   trunk/packages/horizon.pkg/main.py
   trunk/packages/horizon.pkg/providers.py
Log:
Fix rotation based on qgil feedback

Modified: trunk/packages/horizon.pkg/main.py
===================================================================
--- trunk/packages/horizon.pkg/main.py	2009-07-14 22:37:34 UTC (rev 280)
+++ trunk/packages/horizon.pkg/main.py	2009-07-29 20:39:03 UTC (rev 281)
@@ -72,9 +72,7 @@
         
         (x, y, z) = self.provider.position()
         boundary = max(min(z / 1000.0, 1), -1)
-        rotation = atan2(x, y) - pi
-        if (rotation < -pi):
-          rotation += 2*pi
+        rotation = atan2(x, -y)
         
         if (self.rotation <> rotation or self.boundary <> boundary):
           self.rotation = rotation

Modified: trunk/packages/horizon.pkg/providers.py
===================================================================
--- trunk/packages/horizon.pkg/providers.py	2009-07-14 22:37:34 UTC (rev 280)
+++ trunk/packages/horizon.pkg/providers.py	2009-07-29 20:39:03 UTC (rev 281)
@@ -9,23 +9,28 @@
 class Dummy:
     """One of the simplest providers: returns dead-on, flat."""
     def position(self):
-        return (0, -1000, 0)
+        #return (0, 0, -1000) # Back down
+        #return (0, 0, 1000)  # Front down
+        #return (-1000, 0, 0) # Right edge down
+        #return (1000, 0, 0)  # Left edge down
+        #return (0, -1000, 0) # Bottom edge down
+        return (-500, -500, 0) # Bottom right down
 
 
 class Demo:
     """A demonstration provider which will take the user on a tour through
        the air."""
-    x = 0
-    y = -1000
-    z = 0
+    x = 0.0
+    y = 0.0
+    z = 0.0
     
     def position(self):
-        self.x -= 2
-        self.y += 1
-        self.z += 2
-        return (sin(self.x / 150.0 * pi) * 150,
-                cos(self.y / 150.0 * pi) * 200,
-                sin(self.z / 150.0 * pi) * 300)
+        self.x += 0.1
+        self.y += 0.04
+        self.z += 0.03
+        return (sin(self.x) * 550,
+                sin(self.y) * 400 - 200,
+                sin(self.z) * 450)
 
 
 class NokiaAccelerometer:



More information about the Mud-builder-commits mailing list