summaryrefslogtreecommitdiff
path: root/host/simu/robots/marcel
diff options
context:
space:
mode:
authorNicolas Schodet2011-04-29 20:35:20 +0200
committerNicolas Schodet2011-04-29 20:35:20 +0200
commit9c9f35753489cba5a61816104ac294857be20941 (patch)
treeba36dbe8fda70ca491fc499128c6f317c532cbc7 /host/simu/robots/marcel
parentde2a1e81eef5054725ae218afaf51dc8e06dedd0 (diff)
host/simu: transpose transformation matrix, reverse transformation order
This is better because transformations can be built incrementally from the container to the contained. This use the same semantic as OpenGL.
Diffstat (limited to 'host/simu/robots/marcel')
-rw-r--r--host/simu/robots/marcel/model/loader.py4
-rw-r--r--host/simu/robots/marcel/view/loader.py2
-rw-r--r--host/simu/robots/marcel/view/robot.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/host/simu/robots/marcel/model/loader.py b/host/simu/robots/marcel/model/loader.py
index 0270ce79..ae1caa7d 100644
--- a/host/simu/robots/marcel/model/loader.py
+++ b/host/simu/robots/marcel/model/loader.py
@@ -159,8 +159,8 @@ class Loader (Observable):
# If gate is high, drop elements.
if self.load and self.gate_angle > self.GATE_STROKE / 2:
m = TransMatrix ()
- m.rotate (self.robot_position.angle)
m.translate (self.robot_position.pos)
+ m.rotate (self.robot_position.angle)
pos = m.apply ((-250, 0))
for e in self.load:
e.pos = pos
@@ -177,9 +177,9 @@ class Loader (Observable):
return elements
# Matrix to transform an obstacle position into robot coordinates.
m = TransMatrix ()
+ m.rotate (-self.robot_position.angle)
m.translate ((-self.robot_position.pos[0],
-self.robot_position.pos[1]))
- m.rotate (-self.robot_position.angle)
# Look up elements.
# This could be used if clamp blocking is handled or elements are
# pushed:
diff --git a/host/simu/robots/marcel/view/loader.py b/host/simu/robots/marcel/view/loader.py
index 5bda5d5b..d4ed336e 100644
--- a/host/simu/robots/marcel/view/loader.py
+++ b/host/simu/robots/marcel/view/loader.py
@@ -67,8 +67,8 @@ class Loader (Drawable):
(300, 25 + 25 * i + (150 - 20 * i) * ratio))
if self.model.elevator_height is not None:
self.trans_identity ()
- self.trans_rotate (-self.model.elevator_angle)
self.trans_translate ((-100, -100 + self.model.elevator_height))
+ self.trans_rotate (-self.model.elevator_angle)
# Draw clamp load.
if self.model.clamp_load:
elements = self.model.clamp_load
diff --git a/host/simu/robots/marcel/view/robot.py b/host/simu/robots/marcel/view/robot.py
index 4e2135f2..67d505a2 100644
--- a/host/simu/robots/marcel/view/robot.py
+++ b/host/simu/robots/marcel/view/robot.py
@@ -52,8 +52,8 @@ class Robot (simu.inter.drawable.Drawable):
"""Draw the robot."""
self.reset ()
if self.pos is not None:
- self.trans_rotate (self.angle)
self.trans_translate (self.pos)
+ self.trans_rotate (self.angle)
# Draw robot body.
self.draw_polygon ((120, 155), (-95, 155), (-160, 90),
(-160, -90), (-95, -155), (120, -155))