Romain Ame / Mbed 2 deprecated Robot2016_2-0_STATIC

Dependencies:   RoboClaw StepperMotor mbed

Fork of Robot2016_2-0 by ARES

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers point.h Source File

point.h

00001 #ifndef POINT_H
00002 #define POINT_H
00003 
00004 typedef struct P4 points4;
00005 
00006 class point {
00007 public:
00008     point (float nx, float ny) {
00009         x = nx;
00010         y = ny;
00011     }
00012     point () { ; }
00013 
00014     float getX () { return x; }
00015     float getY () { return y; }
00016     void setX(float nx) { x = nx; }
00017     void setY(float ny) { y = ny; }
00018     
00019     float operator*(point& a) {
00020         return calculDistance2 (x, y, a.getX(), a.getY ());
00021     }
00022     bool operator==(point& a) {
00023         return (x == a.getX () && y == a.getY ());
00024     }
00025     bool operator!=(point& a) {
00026         return !(*this == a);
00027     }
00028 
00029 protected:
00030     float calculDistance2(float x1, float y1, float x2, float y2) {
00031         return ((x1-x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
00032     }
00033 
00034     float x, y;
00035 };
00036 
00037 struct P4 {
00038     point p0;
00039     point p1;
00040     point p2;
00041     point p3;
00042 };
00043 
00044 #endif