sotsuron

Fork of linearMirrorMotion1017 by Hiromasa Oku

Committer:
takapiasano
Date:
Wed Jul 24 08:31:32 2013 +0000
Revision:
28:d86c629b6fd3
Parent:
26:74ecbf9985e1
demo draw on tracks

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hiromasaoku 16:6dd2e60bc5bc 1 #include "mbed.h"
hiromasaoku 16:6dd2e60bc5bc 2 #include <vector>
hiromasaoku 19:8e9fe7d25b9c 3 #define PI 3.14159
hiromasaoku 16:6dd2e60bc5bc 4
takapiasano 26:74ecbf9985e1 5 #define RENDER_INTERVAL 600// in microseconds
takapiasano 28:d86c629b6fd3 6 #define WAITING_FIRST 5 // this means WAITING_FIRST number of interrupt cycles in case of the first point
takapiasano 28:d86c629b6fd3 7 #define WAITING_LAST 5
takapiasano 24:ab74d2018e6c 8
takapiasano 24:ab74d2018e6c 9 enum stateMachine{NORMAL_POINT, FIRST_POINT, AFTER_LAST_POINT};
hiromasaoku 17:dce982e0a383 10
hiromasaoku 16:6dd2e60bc5bc 11 struct point2dl {
hiromasaoku 16:6dd2e60bc5bc 12 int x,y;
hiromasaoku 16:6dd2e60bc5bc 13 int laserSwitch; // laser {1: on 0:off} until next step
hiromasaoku 16:6dd2e60bc5bc 14 };
hiromasaoku 16:6dd2e60bc5bc 15
hiromasaoku 16:6dd2e60bc5bc 16 struct letter {
takapiasano 24:ab74d2018e6c 17 int pointnum; //not used for the time being
hiromasaoku 16:6dd2e60bc5bc 18 vector<point2dl> letpoints;
hiromasaoku 16:6dd2e60bc5bc 19 };
hiromasaoku 16:6dd2e60bc5bc 20
hiromasaoku 16:6dd2e60bc5bc 21 class render{
hiromasaoku 16:6dd2e60bc5bc 22 public:
hiromasaoku 16:6dd2e60bc5bc 23 void startRender();
hiromasaoku 16:6dd2e60bc5bc 24 void setRender(vector<letter> *p);
hiromasaoku 16:6dd2e60bc5bc 25 void translating(float speed, float angle);
hiromasaoku 16:6dd2e60bc5bc 26 void stopRender();
hiromasaoku 16:6dd2e60bc5bc 27 void draw();
hiromasaoku 18:6f86abfae754 28 void transform(point2dl& mypoint);
hiromasaoku 18:6f86abfae754 29 void shearing(point2dl& dataBefore);
hiromasaoku 18:6f86abfae754 30 void rotation(point2dl& dataBefore);
takapiasano 26:74ecbf9985e1 31 void updateSpeed(float vvx, float vvy);
hiromasaoku 20:8475768fc2f7 32
hiromasaoku 20:8475768fc2f7 33 int shearingSwitch;
takapiasano 25:423050363215 34 int laserColor;
hiromasaoku 18:6f86abfae754 35
takapiasano 26:74ecbf9985e1 36 int radious;
takapiasano 26:74ecbf9985e1 37 int startSwitch;
takapiasano 26:74ecbf9985e1 38
hiromasaoku 16:6dd2e60bc5bc 39 private:
hiromasaoku 16:6dd2e60bc5bc 40 vector<letter> *ptext;
hiromasaoku 16:6dd2e60bc5bc 41 vector<letter> translated;
hiromasaoku 16:6dd2e60bc5bc 42 int currentLetters;
hiromasaoku 16:6dd2e60bc5bc 43 int currentPoints;
hiromasaoku 16:6dd2e60bc5bc 44 point2dl drawPoint;
hiromasaoku 17:dce982e0a383 45
takapiasano 24:ab74d2018e6c 46 stateMachine rendererState;
takapiasano 24:ab74d2018e6c 47 int firstPointCounter, lastPointCounter;
takapiasano 24:ab74d2018e6c 48
hiromasaoku 17:dce982e0a383 49 Ticker renderTimer;
hiromasaoku 20:8475768fc2f7 50 Timer speedTimer;
hiromasaoku 18:6f86abfae754 51
hiromasaoku 18:6f86abfae754 52 float speed;
hiromasaoku 18:6f86abfae754 53 float angle;
takapiasano 22:e86d63dfbbe1 54 float vx;
takapiasano 22:e86d63dfbbe1 55 float vy;
takapiasano 26:74ecbf9985e1 56 float intvx,intvy;
hiromasaoku 20:8475768fc2f7 57
takapiasano 26:74ecbf9985e1 58
takapiasano 26:74ecbf9985e1 59 };