suppression des angles car trop compliqué et peu utile
This commit is contained in:
parent
dfd33a0a00
commit
9fb9af1229
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue