From 9fb9af12293a852e4d65ca38def8979efb22cb9c Mon Sep 17 00:00:00 2001 From: util1 Date: Fri, 19 Jul 2019 15:10:36 +0200 Subject: [PATCH] =?UTF-8?q?suppression=20des=20angles=20car=20trop=20compl?= =?UTF-8?q?iqu=C3=A9=20et=20peu=20utile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FxEngine/math/angle.cpp | 166 ---------------------------------------- FxEngine/math/angle.h | 65 ---------------- 2 files changed, 231 deletions(-) delete mode 100644 FxEngine/math/angle.cpp delete mode 100644 FxEngine/math/angle.h diff --git a/FxEngine/math/angle.cpp b/FxEngine/math/angle.cpp deleted file mode 100644 index 60cfe16..0000000 --- a/FxEngine/math/angle.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "angle.h" - -// TODO trouver les fonctions math - -double FE_Angle::m_cos[256]; -double FE_Angle::m_sin[256]; -double FE_Angle::m_tan[256]; -//////////////////////////// SURCHARGE D'OPERATEURS -// la surcharge d'opérateurs vise à remplacer toutes les fonctions de modification - -bool FE_Angle::testEgalite(FE_Angle const& angle)const -{return (angle.m_currentValue==this->m_currentValue);} -bool FE_Angle::testEgalite(char const& angle)const -{return (angle==this->m_currentValue);} - -bool FE_Angle::testSuperieur(FE_Angle const& angle)const -{return (angle.m_currentValue>this->m_currentValue);} -bool FE_Angle::testSuperieur(char const& angle)const -{return (angle>this->m_currentValue);} - -/// Comparaisons -// == -bool operator==(FE_Angle const& a, FE_Angle const& b) -{return a.testEgalite(b);} -bool operator==(FE_Angle const& a, char const& b) -{return a.testEgalite(b);} -// != -bool operator!=(FE_Angle const& a, FE_Angle const& b) -{return !(a.testEgalite(b));} -bool operator!=(FE_Angle const& a, char const& b) -{return !(a.testEgalite(b));} -// > -bool operator>(FE_Angle const& a, FE_Angle const& b) -{return a.testSuperieur(b);} -bool operator>(FE_Angle const& a, char const& b) -{return a.testSuperieur(b);} -// <= -bool operator<=(FE_Angle const& a, FE_Angle const& b) -{return !(a>b);} -bool operator<=(FE_Angle const& a, char const& b) -{return !(a>b);} -// >= -bool operator>=(FE_Angle const& a, FE_Angle const& b) -{return (a>b | a==b);} -bool operator>=(FE_Angle const& a, char const& b) -{return (a>b | a==b);} -// < -bool operator<(FE_Angle const& a, FE_Angle const& b) -{return !(a>=b);} -bool operator<(FE_Angle const& a, char const& b) -{return !(a>=b);} - -/// Opérateurs raccourcis -// += -FE_Angle& Angle::operator+=(FE_Angle const& a) -{m_currentValue+= a.m_currentValue;return *this;} -FE_Angle& Angle::operator+=(const char& a) -{m_currentValue+= a;return *this;} -// -= -FE_Angle& Angle::operator-=(FE_Angle const& a) -{ m_currentValue+= -a.m_currentValue;return *this;} -FE_Angle& Angle::operator-=(const char& a) -{m_currentValue+= -a;return *this;} - -FE_Angle& Angle::operator=(const char& a) -{m_currentValue=a;return *this;} - -// + -FE_Angle operator+(FE_Angle const& a,FE_Angle const& b) -{FE_Angle copie(a);copie+=b;return copie;} -FE_Angle operator+(FE_Angle const& a,char const& b) -{FE_Angle copie(a);copie+=b;return copie;} -// - -FE_Angle operator-(FE_Angle const& a,FE_Angle const& b) -{FE_Angle copie(a);copie-=b;return copie;} -FE_Angle operator-(FE_Angle const& a,char const& b) -{FE_Angle copie(a);copie+=-b;return copie;} - - - -bool FE_Angle::hasBeenLoadedBefore = false; -FE_Angle::FE_Angle() -{ - loadAll(); - m_currentValue=0; -} -FE_Angle::FE_Angle(FE_Angle const& angle) -{ - m_currentValue = angle.m_currentValue; -} -FE_Angle::FE_Angle(char angle) -{ - m_currentValue = angle; -} - -float FE_Angle::cos()const -{ - unsigned char angle=m_currentValue; - return m_cos[angle]; -} -float FE_Angle::sin()const -{ - unsigned char angle=m_currentValue; - return m_sin[angle]; -} -float FE_Angle::tan()const -{ - unsigned char angle=m_currentValue; - return m_tan[angle]; -} - -float FE_Angle::cos(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_cos[indice]; -} -float FE_Angle::sin(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_sin[indice]; -} -float FE_Angle::tan(char const angle) -{ - loadAll(); - unsigned char indice=angle; - return m_tan[indice]; -} -float FE_Angle::cos(FE_Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_cos[indice]; -} -float FE_Angle::sin(FE_Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_sin[indice]; -} -float FE_Angle::tan(FE_Angle const& angle) -{ - loadAll(); - unsigned char indice=angle.m_currentValue; - return m_tan[indice]; -} - - - -void FE_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 diff --git a/FxEngine/math/angle.h b/FxEngine/math/angle.h deleted file mode 100644 index 084e704..0000000 --- a/FxEngine/math/angle.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef ANGLE_H -#define ANGLE_H - -class FE_Angle -{ -public: - FE_Angle(); - FE_Angle(char angle); - FE_Angle(FE_Angle const& angle); - - static void loadAll(); // précalcule les cosinus - - - FE_Angle& operator+=(const FE_Angle& a); - FE_Angle& operator+=(const char& a); - FE_Angle& operator++(); - FE_Angle& operator-=(const FE_Angle& a); - FE_Angle& operator-=(const char& a); - FE_Angle& operator--(); - FE_Angle& operator=(const char& a); - bool testEgalite(FE_Angle const& angle) const; - bool testEgalite(char const& angle) const; - bool testSuperieur(FE_Angle const& angle) const; // true si this > angle - bool testSuperieur(char const& angle) const; - - - - float cos()const; - float sin()const; - float tan()const; - static float cos(char const angle); - static float sin(char const angle); - static float tan(char const angle); - static float cos(FE_Angle const& angle); - static float sin(FE_Angle const& angle); - static float tan(FE_Angle const& angle); -protected: - char m_currentValue; - - static bool hasBeenLoadedBefore; - static double m_cos[256],m_sin[256],m_tan[256]; - - -}; - -bool operator==(FE_Angle const& a, FE_Angle const& b); -bool operator>=(FE_Angle const& a, FE_Angle const& b); -bool operator<=(FE_Angle const& a, FE_Angle const& b); -bool operator> (FE_Angle const& a, FE_Angle const& b); -bool operator< (FE_Angle const& a, FE_Angle const& b); - -bool operator==(FE_Angle const& a, char const& b); -bool operator>=(FE_Angle const& a, char const& b); -bool operator<=(FE_Angle const& a, char const& b); -bool operator> (FE_Angle const& a, char const& b); -bool operator< (FE_Angle const& a, char const& b); - - - -FE_Angle operator+(FE_Angle const& a, FE_Angle const& b); -FE_Angle operator-(FE_Angle const& a, FE_Angle const& b); - -FE_Angle operator+(FE_Angle const& a, char const& b); -FE_Angle operator-(FE_Angle const& a, char const& b); -#endif \ No newline at end of file