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.
Dependencies: mbed
Diff: Classes/Vector.h
- Revision:
- 2:1103f5d61035
- Parent:
- 0:8743b606abc3
diff -r a9af73d5abd4 -r 1103f5d61035 Classes/Vector.h
--- a/Classes/Vector.h Wed Feb 26 16:47:05 2020 +0000
+++ b/Classes/Vector.h Wed Mar 11 14:24:48 2020 +0000
@@ -1,11 +1,15 @@
#ifndef VECTOR_H
#define VECTOR_H
-typedef struct
+#include "mbed.h"
+
+struct Point
{
+ Point() {x=0; y=0;}
+ Point(int x, int y) : x(x), y(y) {}
int x;
int y;
-}Point;
+};
class Vector
{
@@ -17,10 +21,22 @@
float getCoeffDir() const;
int getNorme() const;
bool estADroiteDe(Vector& v) const;
+ Vector testJoinedTo(Vector& v) const; // Test si les deux sont joints par un point ; si oui il retourne le nouveau vecteur (AB + BC + AC), si non il retourne le vecteur suivant : Vector(0, 0, 0, 0)
+ int calcDifference(Vector& v1, Vector& v2) const;
+ Point projection() const;
static Vector getVectorAuMilieuDe(Vector& v0, Vector& v1);
+ bool operator==(const Vector& v);
+ bool operator!=(const Vector& v);
+
+ static Vector v1_ideal;
+ static Vector v2_ideal;
+
+ void affVector(Serial& serial) const;
+
private:
Point p0, p1;
};
+
#endif // VECTOR_H
\ No newline at end of file