output only raw data (acceleration, anguler rate, geomagnetism, air pressure)
Dependencies: mbed SDFileSystem ConfigFile
Diff: Vector/Vector.cpp
- Revision:
- 9:6d4578dcc1ed
- Parent:
- 3:5358a691a100
- Child:
- 13:df1e8a650185
--- a/Vector/Vector.cpp Fri Jun 12 15:28:05 2015 +0000 +++ b/Vector/Vector.cpp Mon Jun 15 10:40:18 2015 +0000 @@ -31,6 +31,16 @@ return *this; } +Vector Vector::operator+() { + return *this; +} + +Vector Vector::operator-() { + Vector retVec(*this); + retVec *= -1; + return retVec; +} + Vector& Vector::operator*=(float c) { for (int i = 0; i < dim; i++) { components[i] *= c; @@ -93,6 +103,15 @@ return temp; } +Vector Vector::GetParaCompTo(Vector v) { + Vector norm_v = v.Normalize(); + return (*this * norm_v) * norm_v; +} + +Vector Vector::GetPerpCompTo(Vector v) { + return (*this - this->GetParaCompTo(v)); +} + void Vector::CleanUp() { float maxComp = 0.0f; for (int i = 0; i < dim; i++) {