MPUとHMCでうごくかもver

Dependencies:   ConfigFile SDFileSystem mbed

Fork of LAURUS_program by hiroya taura

Committer:
ojan
Date:
Fri May 15 17:24:32 2015 +0000
Revision:
0:bc6f14fc60c7
Child:
9:6d4578dcc1ed
Laurus integrated program (ver.0.0)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ojan 0:bc6f14fc60c7 1 #pragma once
ojan 0:bc6f14fc60c7 2 #include "ErrorLogger.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 0:bc6f14fc60c7 13 Vector& operator*=(float c);
ojan 0:bc6f14fc60c7 14 Vector& operator/=(float c);
ojan 0:bc6f14fc60c7 15 Vector& operator+=(const Vector& v);
ojan 0:bc6f14fc60c7 16 Vector& operator-=(const Vector& v);
ojan 0:bc6f14fc60c7 17
ojan 0:bc6f14fc60c7 18 void SetComp(int dimNo, float val);
ojan 0:bc6f14fc60c7 19 float GetNorm() const;
ojan 0:bc6f14fc60c7 20 Vector Normalize() const;
ojan 0:bc6f14fc60c7 21
ojan 0:bc6f14fc60c7 22 inline int GetDim() const {
ojan 0:bc6f14fc60c7 23 return dim;
ojan 0:bc6f14fc60c7 24 }
ojan 0:bc6f14fc60c7 25
ojan 0:bc6f14fc60c7 26 inline const float* GetpComponents() const {
ojan 0:bc6f14fc60c7 27 return (const float*)components;
ojan 0:bc6f14fc60c7 28 }
ojan 0:bc6f14fc60c7 29
ojan 0:bc6f14fc60c7 30 inline float GetComp(int dimNo) const {
ojan 0:bc6f14fc60c7 31 if (dimNo > dim) AbortWithMsg("Index Out of Bounds Error !!");
ojan 0:bc6f14fc60c7 32 return components[dimNo-1];
ojan 0:bc6f14fc60c7 33 }
ojan 0:bc6f14fc60c7 34
ojan 0:bc6f14fc60c7 35 void CleanUp();
ojan 0:bc6f14fc60c7 36
ojan 0:bc6f14fc60c7 37 private:
ojan 0:bc6f14fc60c7 38 int dim;
ojan 0:bc6f14fc60c7 39 float* components;
ojan 0:bc6f14fc60c7 40
ojan 0:bc6f14fc60c7 41 Vector& operator*=(const Matrix& m);
ojan 0:bc6f14fc60c7 42 Vector& operator*=(const Vector& m);
ojan 0:bc6f14fc60c7 43 };
ojan 0:bc6f14fc60c7 44
ojan 0:bc6f14fc60c7 45 Vector operator+(const Vector& lhv, const Vector& rhv);
ojan 0:bc6f14fc60c7 46 Vector operator-(const Vector& lhv, const Vector& rhv);
ojan 0:bc6f14fc60c7 47 Vector Cross(const Vector& lhv, const Vector& rhv);
ojan 0:bc6f14fc60c7 48 Vector operator*(const float c, const Vector& rhv);
ojan 0:bc6f14fc60c7 49 Vector operator*(const Vector& lhv, const float c);
ojan 0:bc6f14fc60c7 50 float operator*(const Vector& lhv, const Vector& rhv);
ojan 0:bc6f14fc60c7 51