Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Timer by
Diff: Map/point.h
- Revision:
- 47:be4eebf40568
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Map/point.h Mon Apr 25 12:42:32 2016 +0000
@@ -0,0 +1,44 @@
+#ifndef POINT_H
+#define POINT_H
+
+typedef struct P4 points4;
+
+class point {
+public:
+ point (float nx, float ny) {
+ x = nx;
+ y = ny;
+ }
+ point () { ; }
+
+ float getX () { return x; }
+ float getY () { return y; }
+ void setX(float nx) { x = nx; }
+ void setY(float ny) { y = ny; }
+
+ float operator*(point& a) {
+ return calculDistance2 (x, y, a.getX(), a.getY ());
+ }
+ bool operator==(point& a) {
+ return (x == a.getX () && y == a.getY ());
+ }
+ bool operator!=(point& a) {
+ return !(*this == a);
+ }
+
+protected:
+ float calculDistance2(float x1, float y1, float x2, float y2) {
+ return ((x1-x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
+ }
+
+ float x, y;
+};
+
+struct P4 {
+ point p0;
+ point p1;
+ point p2;
+ point p3;
+};
+
+#endif
\ No newline at end of file
