diff --git a/SH3D/mathmodule/angle.cpp b/SH3D/mathmodule/angle.cpp deleted file mode 100644 index c0b02f1..0000000 --- a/SH3D/mathmodule/angle.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include "angle.h" -extern "C" -{ - #include -} - -double Angle::m_cos[256]; -double Angle::m_sin[256]; -double Angle::m_tan[256]; -//////////////////////////// SURCHARGE D'OPERATEURS -// la surcharge d'opérateurs vise à remplacer toutes les fonctions de modification - -bool Angle::testEgalite(Angle const& angle)const -{return (angle.m_currentValue==this->m_currentValue);} -bool Angle::testEgalite(char const& angle)const -{return (angle==this->m_currentValue);} - -bool Angle::testSuperieur(Angle const& angle)const -{return (angle.m_currentValue>this->m_currentValue);} -bool Angle::testSuperieur(char const& angle)const -{return (angle>this->m_currentValue);} - -/// Comparaisons -// == -bool operator==(Angle const& a, Angle const& b) -{return a.testEgalite(b);} -bool operator==(Angle const& a, char const& b) -{return a.testEgalite(b);} -// != -bool operator!=(Angle const& a, Angle const& b) -{return !(a.testEgalite(b));} -bool operator!=(Angle const& a, char const& b) -{return !(a.testEgalite(b));} -// > -bool operator>(Angle const& a, Angle const& b) -{return a.testSuperieur(b);} -bool operator>(Angle const& a, char const& b) -{return a.testSuperieur(b);} -// <= -bool operator<=(Angle const& a, Angle const& b) -{return !(a>b);} -bool operator<=(Angle const& a, char const& b) -{return !(a>b);} -// >= -bool operator>=(Angle const& a, Angle const& b) -{return (a>b | a==b);} -bool operator>=(Angle const& a, char const& b) -{return (a>b | a==b);} -// < -bool operator<(Angle const& a, Angle const& b) -{return !(a>=b);} -bool operator<(Angle const& a, char const& b) -{return !(a>=b);} - -/// Opérateurs raccourcis -// += -Angle& Angle::operator+=(Angle const& a) -{m_currentValue+= a.m_currentValue;return *this;} -Angle& Angle::operator+=(const char& a) -{m_currentValue+= a;return *this;} -// -= -Angle& Angle::operator-=(Angle const& a) -{ m_currentValue+= -a.m_currentValue;return *this;} -Angle& Angle::operator-=(const char& a) -{m_currentValue+= -a;return *this;} - -Angle& Angle::operator=(const char& a) -{m_currentValue=a;return *this;} - -// + -Angle operator+(Angle const& a,Angle const& b) -{Angle copie(a);copie+=b;return copie;} -Angle operator+(Angle const& a,char const& b) -{Angle copie(a);copie+=b;return copie;} -// - -Angle operator-(Angle const& a,Angle const& b) -{Angle copie(a);copie-=b;return copie;} -Angle operator-(Angle const& a,char const& b) -{Angle copie(a);copie+=-b;return copie;} - - - -bool Angle::hasBeenLoadedBefore = false; -Angle::Angle() -{ - loadAll(); - m_currentValue=0; -} -Angle::Angle(Angle const& angle) -{ - m_currentValue = angle.m_currentValue; -} -Angle::Angle(char angle) -{ - m_currentValue = angle; -} - -double Angle::cos()const -{ - unsigned char angle=m_currentValue; - return m_cos[angle]; -} -double Angle::sin()const -{ - unsigned char angle=m_currentValue; - return m_sin[angle]; -} -double Angle::tan()const -{ - unsigned char angle=m_currentValue; - return m_tan[angle]; -} - -double Angle::cos(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_cos[indice]; -} -double Angle::sin(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_sin[indice]; -} -double Angle::tan(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_tan[indice]; -} -double Angle::cos(Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_cos[indice]; -} -double Angle::sin(Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_sin[indice]; -} -double Angle::tan(Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_tan[indice]; -} - - - -void Angle::loadAll() -{ - if (!hasBeenLoadedBefore) - { - hasBeenLoadedBefore=true; - double radians; - unsigned char angle; - for (angle=-128;angle<128;angle++) - { - radians=((double)angle-128)/128* 6.28318530718; - m_cos[angle]=cos(radians); - m_sin[angle]=sin(radians); - m_tan[angle]=tan(radians); - } - } -} \ No newline at end of file