18 #ifndef _SDF_TYPES_HH_
19 #define _SDF_TYPES_HH_
30 #define SDF_DEPRECATED(version) __attribute__((deprecated))
31 #define SDF_FORCEINLINE __attribute__((always_inline))
33 #define SDF_DEPRECATED(version)
34 #define SDF_FORCEINLINE __forceinline
36 #define SDF_DEPRECATED(version)
37 #define SDF_FORCEINLINE
54 inline bool equal(
const T &_a,
const T &_b,
55 const T &_epsilon = 1e-6f)
57 return std::fabs(_a - _b) <= _epsilon;
68 public:
Color(
float _r = 0.0f,
float _g = 0.0f,
69 float _b = 0.0f,
float _a = 1.0f)
70 : r(_r), g(_g), b(_b), a(_a) {}
76 public:
friend std::ostream &operator<< (std::ostream &_out,
79 _out << _pt.
r <<
" " << _pt.
g <<
" " << _pt.
b <<
" " << _pt.
a;
86 public:
friend std::istream &operator>> (std::istream &_in,
Color &_pt)
89 _in.setf(std::ios_base::skipws);
90 _in >> _pt.
r >> _pt.
g >> _pt.
b >> _pt.
a;
97 public:
bool operator ==(
const Color &_clr)
const
99 return equal(this->r, _clr.
r) &&
131 public:
Time(int32_t _sec, int32_t _nsec)
132 : sec(_sec), nsec(_nsec)
143 _out << _time.
sec <<
" " << _time.
nsec;
155 _in.setf(std::ios_base::skipws);
156 _in >> _time.
sec >> _time.
nsec;
163 public:
bool operator ==(
const Time &_time)
const
165 return this->sec == _time.
sec && this->nsec == _time.
nsec;
float b
Blue value.
Definition: Types.hh:112
int32_t sec
Seconds.
Definition: Types.hh:169
double mass
Definition: Types.hh:178
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
Time()
Constructor.
Definition: Types.hh:123
SDFORMAT_VISIBLE const char * winGetEnv(const char *_name)
Windows equivalent of getEnv.
Time(int32_t _sec, int32_t _nsec)
Constructor.
Definition: Types.hh:131
Defines a color.
Definition: Types.hh:61
float r
Red value.
Definition: Types.hh:106
A class for inertial information about a link.
Definition: Types.hh:176
A Time class, can be used to hold wall- or sim-time.
Definition: Types.hh:120
friend std::ostream & operator<<(std::ostream &_out, const Time &_time)
Stream insertion operator.
Definition: Types.hh:140
friend std::istream & operator>>(std::istream &_in, Time &_time)
Stream extraction operator.
Definition: Types.hh:151
bool equal(const T &_a, const T &_b, const T &_epsilon=1e-6f)
check if two values are equal, within a tolerance
Definition: Types.hh:54
Color(float _r=0.0f, float _g=0.0f, float _b=0.0f, float _a=1.0f)
Constructor.
Definition: Types.hh:68
float g
Green value.
Definition: Types.hh:109
float a
Alpha value.
Definition: Types.hh:115
int32_t nsec
Nanoseconds.
Definition: Types.hh:172