32#ifndef RCSC_GEOM_ANGLEDEG_H
33#define RCSC_GEOM_ANGLEDEG_H
63 static const double PI;
108 if ( M_degree < -360.0 || 360.0 < M_degree )
110 M_degree = std::fmod( M_degree, 360.0 );
113 if ( M_degree < -180.0 )
118 if ( M_degree > 180.0 )
144 return std::fabs(
degree() );
179 M_degree += angle.
degree();
203 M_degree -= angle.
degree();
239 if ( std::fabs( scalar ) <
EPSILON )
257 return ( ( 0.0 < diff && diff < 180.0 )
269 return ( ( 0.0 <= diff && diff < 180.0 )
281 return ( ( 0.0 < diff && diff < 180.0 )
293 return ( ( 0.0 <= diff && diff < 180.0 )
339 void sinMinMax(
const double & angle_err,
341 double * maxsin )
const;
349 void cosMinMax(
const double & angle_err,
351 double * maxcos )
const;
365 if ( dir < -360.0 || 360.0 < dir )
367 dir = std::fmod( dir, 360.0 );
416 return std::cos(
deg2rad( deg ) );
428 return std::sin(
deg2rad( deg ) );
440 return std::tan(
deg2rad( deg ) );
452 return ( cosine >= 1.0
456 :
rad2deg( std::acos( cosine ) ) ) );
472 :
rad2deg( std::asin( sine ) ) ) );
484 return rad2deg( std::atan( tangent ) );
498 return ( ( x == 0.0 && y == 0.0 )
500 :
rad2deg( std::atan2( y, x ) ) );
522 std::ostream &
print( std::ostream & os )
const
534 const double & step = 0.1 )
const
536 return os << rint(
degree() / step ) * step;
545 :
public std::binary_function< AngleDeg, AngleDeg, bool > {
549 const second_argument_type & rhs )
const
551 return lhs.degree() < rhs.degree();
565 :
public std::unary_function< AngleDeg, bool > {
579 return angle.isWithin( M_left, M_right );
792 return a.
print( os );
bool operator==(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
predicate operator ==
Definition angle_deg.h:743
std::ostream & operator<<(std::ostream &os, const rcsc::AngleDeg &a)
output to ostream
Definition angle_deg.h:789
const rcsc::AngleDeg operator+(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
operator add(T, T)
Definition angle_deg.h:600
bool operator!=(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
predicate operator !=
Definition angle_deg.h:698
const rcsc::AngleDeg operator-(const rcsc::AngleDeg &lhs, const rcsc::AngleDeg &rhs)
operator sub(T, T)
Definition angle_deg.h:648
predicate function object. this compares two angles by degree value
Definition angle_deg.h:545
result_type operator()(const first_argument_type &lhs, const second_argument_type &rhs) const
operator method
Definition angle_deg.h:548
degree wrapper class
Definition angle_deg.h:45
static double cos_deg(const double °)
static utility. calculate cosine value for degree angle
Definition angle_deg.h:414
double tan() const
calculate tarngetn
Definition angle_deg.h:319
double radian() const
get RADIAN value.
Definition angle_deg.h:150
bool isLeftEqualOf(const AngleDeg &angle) const
check if this angle is left or equal of 'angle'
Definition angle_deg.h:265
const double & degree() const
get value of this angle
Definition angle_deg.h:133
static double deg2rad(const double °)
static utility. convert degree to radian
Definition angle_deg.h:402
double cos() const
calculate cosine
Definition angle_deg.h:301
static double atan_deg(const double &tangent)
static utility. calculate arc tangent value
Definition angle_deg.h:482
static double rad2deg(const double &rad)
static utility. convert radian to degree
Definition angle_deg.h:390
const AngleDeg & operator+=(const AngleDeg &angle)
operator += with AngleDeg
Definition angle_deg.h:177
const AngleDeg & operator+=(const double °)
operator += with double
Definition angle_deg.h:189
static double sin_deg(const double °)
static utility. calculate sine value for degree angle
Definition angle_deg.h:426
AngleDeg(const double °)
constructor with value.
Definition angle_deg.h:82
bool isRightOf(const AngleDeg &angle) const
check if this angle is right of 'angle'
Definition angle_deg.h:277
const AngleDeg & operator*=(const double &scalar)
operator *=
Definition angle_deg.h:225
static const double PI
pi valur
Definition angle_deg.h:63
const AngleDeg & operator-=(const AngleDeg &angle)
operator -= with AngleDeg
Definition angle_deg.h:201
static double atan2_deg(const double &y, const double &x)
static utility. calculate arc tangent value from XY
Definition angle_deg.h:495
const AngleDeg & operator=(const double °)
operator substitution.
Definition angle_deg.h:94
static double normalize_angle(double dir)
static utility. normalize angle
Definition angle_deg.h:363
static const double DEG2RAD
constant variable to convert DEGREE to RADIAN.
Definition angle_deg.h:67
AngleDeg operator-() const
get new AngleDeg multiplyed by -1.
Definition angle_deg.h:166
static double asin_deg(const double &sine)
static utility. calculate arc sine value
Definition angle_deg.h:466
static const double TWO_PI
2*pi valur
Definition angle_deg.h:65
bool isRightEqualOf(const AngleDeg &angle) const
check if this angle is right or equal of 'angle'
Definition angle_deg.h:289
std::ostream & print(std::ostream &os) const
output value to ostream
Definition angle_deg.h:522
static const double RAD2DEG
constant variable to convert RADIAN to DEGREE.
Definition angle_deg.h:69
AngleDeg()
default constructor.
Definition angle_deg.h:72
std::ostream & printRound(std::ostream &os, const double &step=0.1) const
output rounded value to ostream
Definition angle_deg.h:533
void cosMinMax(const double &angle_err, double *mincos, double *maxcos) const
calculate min/max cosine value of angle with angle error.
Definition angle_deg.cpp:135
static const double EPSILON
epsilon value
Definition angle_deg.h:60
static AngleDeg bisect(const AngleDeg &left, const AngleDeg &right)
static utility that returns bisect angle of [left, right].
Definition angle_deg.cpp:177
static double tan_deg(const double °)
static utility. calculate tangent value for degree angle
Definition angle_deg.h:438
const AngleDeg & operator/=(const double &scalar)
operator /=
Definition angle_deg.h:237
double sin() const
calculate sine
Definition angle_deg.h:310
double abs() const
get absolute value of this angle
Definition angle_deg.h:142
void sinMinMax(const double &angle_err, double *minsin, double *maxsin) const
calculate min/max sine value with angle error.
Definition angle_deg.cpp:90
bool isLeftOf(const AngleDeg &angle) const
check if this angle is left of 'angle'
Definition angle_deg.h:253
const AngleDeg & operator-=(const double °)
operator -= with double
Definition angle_deg.h:213
bool isWithin(const AngleDeg &left, const AngleDeg &right) const
check if this angle is within [left, right] (turn clockwise).
Definition angle_deg.cpp:60
static double acos_deg(const double &cosine)
static utility. calculate arc cosine value
Definition angle_deg.h:450
AngleIsWithin(const AngleDeg &left, const AngleDeg &right)
constructor
Definition angle_deg.h:570
result_type operator()(const argument_type &angle) const
operator method
Definition angle_deg.h:577