this version 10/17

Dependencies:   mbed

Fork of linearMirrorMotion by Alvaro Cassinelli

Revision:
15:1d931a305464
Parent:
14:314b86828ed2
Child:
16:6dd2e60bc5bc
diff -r 314b86828ed2 -r 1d931a305464 main.cpp
--- a/main.cpp	Fri Apr 05 08:21:46 2013 +0000
+++ b/main.cpp	Mon Apr 08 03:13:15 2013 +0000
@@ -33,10 +33,10 @@
     int laserSwitch;   // laser {1: on 0:off} until next step
 };
 
-point2dl shearing(point2dl dataBefore, float velocity){
+point2dl shearing(point2dl dataBefore, float velocity, float theta){
     point2dl dataAfter;
-    dataAfter.x = dataBefore.x + velocity*timer_v.read_us()/st/1000;   //st is a parameter for ajustment
-    dataAfter.y = dataBefore.y;
+    dataAfter.x = dataBefore.x + velocity * cos(theta) * timer_v.read_us()/st/1000;   //st is a parameter for ajustment
+    dataAfter.y = dataBefore.y + velocity * sin(theta) * timer_v.read_us()/st/1000; 
     dataAfter.laserSwitch = dataBefore.laserSwitch;
     
     return dataAfter;
@@ -154,8 +154,8 @@
             
                 if (pc.readable()>0) processSerial();
                 
-                point2dl sheared = shearing(libletter[inputletters[i]-'a'].letpoints[j] , radious*angularSpeed );
-                point2dl rotated = rotation(sheared, angle);
+                point2dl rotated = rotation(libletter[inputletters[i]-'a'].letpoints[j] ,angle);
+                point2dl sheared = shearing(rotated ,radious*angularSpeed, angle);
                 X = CENTER_AD_MIRROR_X + radious * cost;
                 Y = CENTER_AD_MIRROR_Y + radious * sint;
                 IO.writeOutXY(X + rotated.x,Y + rotated.y );