8 #ifndef ISEEML_OBJECT_HH
9 #define ISEEML_OBJECT_HH
19 #define _USE_MATH_DEFINES
25 #include <iSeeML/NameSpaces.hpp>
55 static const double smallDouble;
61 static const string ClassName;
85 virtual const string className()
const {
return ClassName; }
111 virtual void writeTo(ostream& O)
const = 0;
143 #ifdef ISEEML_CHECK_OBJECT_PRECOND
144 cerr << ClassName <<
"::algCoord: empty algebraic vector,"
145 << endl <<
" returning zero..." << endl;
162 int i; O <<
'(';
for(i = 1; i <= algDimension(); i++)
163 O << algCoord(i) << (i == algDimension() ?
")" :
", "); }
182 {
return( className() == other.
className() ); }
196 static const T&
min(
const T& a,
const T& b)
197 {
return( a < b ? a : b ); }
210 static const T&
max(
const T& a,
const T& b)
211 {
return( a > b ? a : b ); }
220 static double sqr(
const double& x) {
return( x * x ); }
232 static double mod2pi(
const double& theta) {
233 double res = theta;
const double PIx2 = 2 * M_PI;
236 while (res <= - M_PI)
248 {
return theta * 180 / M_PI; }
257 {
return theta * M_PI / 180; }
269 {
return( x > smallDouble ); }
283 {
return( isPositive(- x) ); }
293 {
return( fabs(x) < smallDouble ); }
305 static int sign(
const double& x)
306 {
return( isZero(x) ? 0 : ( x < 0 ? -1 : 1) ); }
327 #endif // end of definition
virtual void algWriteTo(ostream &O) const
Description method for algebraic vectors, writing this vector in a given output stream: coordinates f...
Definition: Object.hpp:161
static double rad2deg(const double &theta)
Method transforming an angle in radian, with between -1 (excluded) and 1 (included),...
Definition: Object.hpp:247
static double deg2rad(const double &theta)
Method transforming an angle in degree, with between -1 (excluded) and 1 (included),...
Definition: Object.hpp:256
static double sqr(const double &x)
Method giving the square of a double.
Definition: Object.hpp:220
bool sameClass(const iSeeML::Object &other)
Method verifying that a given object has the same type (same class name) than the current one.
Definition: Object.hpp:181
ostream & operator<<(ostream &O, const iSeeML::Object &o)
Modification method, writing a description of a ISeeML object in a given output stream.
Definition: Object.hpp:323
virtual ~Object()
This virtual class needs a virtual destructor.
Definition: Object.hpp:67
static double mod2pi(const double &theta)
Method giving the angle between - (excluded) and (included), which is equal to a given angle modulo...
Definition: Object.hpp:232
static const T & max(const T &a, const T &b)
Method giving the maximum of two elements.
Definition: Object.hpp:210
static bool isZero(const double &x)
Method comparing a double to zero.
Definition: Object.hpp:292
static const T & min(const T &a, const T &b)
Method giving the minimum of two elements.
Definition: Object.hpp:196
This class is the base class of ISeeML: every class of ISeeML inherits this one.
Definition: Object.hpp:47
static int sign(const double &x)
Method giving the sign of a double.
Definition: Object.hpp:305
virtual int algDimension() const
Description method for algebraic vectors, giving the dimension of the containing space (default is ze...
Definition: Object.hpp:125
static bool isPositive(const double &x)
Method telling whether a double is strictly positive.
Definition: Object.hpp:268
static bool isNegative(const double &x)
Method telling whether a double is strictly negative.
Definition: Object.hpp:282
virtual void writeTo(ostream &O) const =0
Description method, writing a description of the object into a given output stream.
virtual const string className() const
Description method, giving the object's class name.
Definition: Object.hpp:85
virtual double algCoord(const int) const
Description method for algebraic vectors, giving coordinate of given index for this vector.
Definition: Object.hpp:142