sotsuron

Fork of linearMirrorMotion1017 by Hiromasa Oku

Committer:
takapiasano
Date:
Tue Jul 02 08:26:45 2013 +0000
Revision:
24:ab74d2018e6c
Parent:
22:e86d63dfbbe1
Child:
25:423050363215
draw function betterized

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 24:ab74d2018e6c 5 #define RENDER_INTERVAL 500// in microseconds
takapiasano 24:ab74d2018e6c 6 #define WAITING_FIRST 1 // this means WAITING_FIRST number of interrupt cycles in case of the first point
takapiasano 24:ab74d2018e6c 7 #define WAITING_LAST 1
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 22:e86d63dfbbe1 31 void updateSpeed(float gspeed, float gangle, float vvx, float vvy);
hiromasaoku 20:8475768fc2f7 32
hiromasaoku 20:8475768fc2f7 33 int shearingSwitch;
hiromasaoku 18:6f86abfae754 34
hiromasaoku 16:6dd2e60bc5bc 35 private:
hiromasaoku 16:6dd2e60bc5bc 36 vector<letter> *ptext;
hiromasaoku 16:6dd2e60bc5bc 37 vector<letter> translated;
hiromasaoku 16:6dd2e60bc5bc 38 int currentLetters;
hiromasaoku 16:6dd2e60bc5bc 39 int currentPoints;
hiromasaoku 16:6dd2e60bc5bc 40 point2dl drawPoint;
hiromasaoku 17:dce982e0a383 41
takapiasano 24:ab74d2018e6c 42 stateMachine rendererState;
takapiasano 24:ab74d2018e6c 43 int firstPointCounter, lastPointCounter;
takapiasano 24:ab74d2018e6c 44
hiromasaoku 17:dce982e0a383 45 Ticker renderTimer;
hiromasaoku 20:8475768fc2f7 46 Timer speedTimer;
hiromasaoku 18:6f86abfae754 47
hiromasaoku 18:6f86abfae754 48 float speed;
hiromasaoku 18:6f86abfae754 49 float angle;
takapiasano 22:e86d63dfbbe1 50 float vx;
takapiasano 22:e86d63dfbbe1 51 float vy;
takapiasano 22:e86d63dfbbe1 52 int radious;
hiromasaoku 20:8475768fc2f7 53
hiromasaoku 16:6dd2e60bc5bc 54 };