output only raw data (acceleration, anguler rate, geomagnetism, air pressure)
Dependencies: mbed SDFileSystem ConfigFile
Vector/Vector.h@34:4bda9af9a0cd, 2015-08-06 (annotated)
- Committer:
- ojan
- Date:
- Thu Aug 06 15:45:48 2015 +0000
- Revision:
- 34:4bda9af9a0cd
- Parent:
- 23:79cdc1432160
LAURUS_Program_v2.9.0; ; + add RULE3_1; + add "volatile" to some variables like "flag"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ojan | 0:bc6f14fc60c7 | 1 | #pragma once |
ojan | 23:79cdc1432160 | 2 | #include "mbed.h" |
ojan | 0:bc6f14fc60c7 | 3 | |
ojan | 0:bc6f14fc60c7 | 4 | class Matrix; |
ojan | 0:bc6f14fc60c7 | 5 | |
ojan | 0:bc6f14fc60c7 | 6 | class Vector { |
ojan | 0:bc6f14fc60c7 | 7 | public: |
ojan | 0:bc6f14fc60c7 | 8 | Vector(int dim); |
ojan | 0:bc6f14fc60c7 | 9 | ~Vector(); |
ojan | 0:bc6f14fc60c7 | 10 | Vector(const Vector& v); |
ojan | 0:bc6f14fc60c7 | 11 | |
ojan | 0:bc6f14fc60c7 | 12 | Vector& operator=(const Vector& v); |
ojan | 9:6d4578dcc1ed | 13 | Vector operator+(); |
ojan | 9:6d4578dcc1ed | 14 | Vector operator-(); |
ojan | 0:bc6f14fc60c7 | 15 | Vector& operator*=(float c); |
ojan | 0:bc6f14fc60c7 | 16 | Vector& operator/=(float c); |
ojan | 0:bc6f14fc60c7 | 17 | Vector& operator+=(const Vector& v); |
ojan | 0:bc6f14fc60c7 | 18 | Vector& operator-=(const Vector& v); |
ojan | 0:bc6f14fc60c7 | 19 | |
ojan | 0:bc6f14fc60c7 | 20 | void SetComp(int dimNo, float val); |
ojan | 13:df1e8a650185 | 21 | void SetComps(float* vals); |
ojan | 0:bc6f14fc60c7 | 22 | float GetNorm() const; |
ojan | 0:bc6f14fc60c7 | 23 | Vector Normalize() const; |
ojan | 9:6d4578dcc1ed | 24 | Vector GetParaCompTo(Vector v); |
ojan | 9:6d4578dcc1ed | 25 | Vector GetPerpCompTo(Vector v); |
ojan | 0:bc6f14fc60c7 | 26 | |
ojan | 0:bc6f14fc60c7 | 27 | inline int GetDim() const { |
ojan | 0:bc6f14fc60c7 | 28 | return dim; |
ojan | 0:bc6f14fc60c7 | 29 | } |
ojan | 0:bc6f14fc60c7 | 30 | |
ojan | 0:bc6f14fc60c7 | 31 | inline const float* GetpComponents() const { |
ojan | 0:bc6f14fc60c7 | 32 | return (const float*)components; |
ojan | 0:bc6f14fc60c7 | 33 | } |
ojan | 0:bc6f14fc60c7 | 34 | |
ojan | 0:bc6f14fc60c7 | 35 | inline float GetComp(int dimNo) const { |
ojan | 23:79cdc1432160 | 36 | if (dimNo > dim) error("Index Out of Bounds Error !!"); |
ojan | 0:bc6f14fc60c7 | 37 | return components[dimNo-1]; |
ojan | 0:bc6f14fc60c7 | 38 | } |
ojan | 0:bc6f14fc60c7 | 39 | |
ojan | 0:bc6f14fc60c7 | 40 | void CleanUp(); |
ojan | 0:bc6f14fc60c7 | 41 | |
ojan | 0:bc6f14fc60c7 | 42 | private: |
ojan | 0:bc6f14fc60c7 | 43 | int dim; |
ojan | 0:bc6f14fc60c7 | 44 | float* components; |
ojan | 0:bc6f14fc60c7 | 45 | |
ojan | 0:bc6f14fc60c7 | 46 | Vector& operator*=(const Matrix& m); |
ojan | 0:bc6f14fc60c7 | 47 | Vector& operator*=(const Vector& m); |
ojan | 0:bc6f14fc60c7 | 48 | }; |
ojan | 0:bc6f14fc60c7 | 49 | |
ojan | 0:bc6f14fc60c7 | 50 | Vector operator+(const Vector& lhv, const Vector& rhv); |
ojan | 0:bc6f14fc60c7 | 51 | Vector operator-(const Vector& lhv, const Vector& rhv); |
ojan | 0:bc6f14fc60c7 | 52 | Vector Cross(const Vector& lhv, const Vector& rhv); |
ojan | 0:bc6f14fc60c7 | 53 | Vector operator*(const float c, const Vector& rhv); |
ojan | 0:bc6f14fc60c7 | 54 | Vector operator*(const Vector& lhv, const float c); |
ojan | 0:bc6f14fc60c7 | 55 | float operator*(const Vector& lhv, const Vector& rhv); |
ojan | 0:bc6f14fc60c7 | 56 |