20 #ifndef LIBREPCB_CORE_ANGLE_H 21 #define LIBREPCB_CORE_ANGLE_H 77 Q_DECLARE_TR_FUNCTIONS(
Angle)
99 explicit Angle(qint32 microdegrees) noexcept
194 qreal
toRad() const noexcept {
return toDeg() / (180.0 / M_PI); }
438 stream << angle.
toDeg();
443 stream << QString(
"Angle(%1°)").arg(angle.
toDeg());
447 inline uint
qHash(
const Angle& key, uint seed = 0) noexcept {
455 using Angle3D = std::tuple<Angle, Angle, Angle>;
bool operator==(const Angle &rhs) const
Definition: angle.h:402
static Angle deg180() noexcept
180 degrees
Definition: angle.h:350
QDataStream & operator<<(QDataStream &stream, const AttributeKey &obj)
Definition: attributekey.h:108
Angle mappedTo180deg() const noexcept
Get an Angle object which is mapped to [-180..+180[ degrees.
Definition: angle.cpp:104
uint qHash(const Angle &key, uint seed=0) noexcept
Definition: angle.h:447
bool operator==(qint32 rhs) const
Definition: angle.h:405
QString toDegString() const noexcept
Get the angle in degrees as a QString.
Definition: angle.cpp:45
static Angle deg90() noexcept
90 degrees
Definition: angle.h:348
Angle & round(const Angle &interval) noexcept
Round the angle to a given interval.
Definition: angle.cpp:81
bool operator>(const Angle &rhs) const
Definition: angle.h:386
Angle & operator+=(const Angle &rhs)
Definition: angle.h:360
Angle & invert() noexcept
Invert the angle.
Definition: angle.cpp:66
qreal toRad() const noexcept
Get the angle in radians.
Definition: angle.h:194
bool operator<(qint32 rhs) const
Definition: angle.h:393
Definition: occmodel.cpp:76
void setAngleDeg(qreal degrees) noexcept
Set the angle in degrees.
Definition: angle.h:129
Angle & makeAbs() noexcept
Make the angle absolute (mMicrodegrees >= 0)
Definition: angle.cpp:55
void setAngleMicroDeg(qint32 microdegrees) noexcept
Set the angle in microdegrees.
Definition: angle.h:114
qreal toDeg() const noexcept
Get the Angle in degrees.
Definition: angle.h:176
static Angle fromDeg(qreal degrees) noexcept
Get an Angle object with a specific angle.
Definition: angle.cpp:120
Angle operator+(const Angle &rhs) const
Definition: angle.h:368
Angle operator*(qint32 rhs) const
Definition: angle.h:378
~Angle() noexcept
Destructor.
Definition: angle.h:105
static Angle deg135() noexcept
135 degrees
Definition: angle.h:349
Angle() noexcept
Default Constructor.
Definition: angle.h:85
The Angle class is used to represent an angle (for example 12.75 degrees)
Definition: angle.h:76
Angle mappedTo0_360deg() const noexcept
Get an Angle object which is mapped to [0..360[ degrees.
Definition: angle.cpp:93
Angle & operator=(const Angle &rhs)
Definition: angle.h:356
void setAngleRad(qreal radians) noexcept
Set the angle in radians.
Definition: angle.h:158
Angle operator/(const Angle &rhs) const
Definition: angle.h:379
bool operator!=(qint32 rhs) const
Definition: angle.h:409
Angle & mapTo0_360deg() noexcept
Map this Angle object to [0..360[ degrees.
Definition: angle.cpp:99
static Angle deg0() noexcept
0 degrees
Definition: angle.h:346
static Angle deg315() noexcept
315 degrees
Definition: angle.h:353
static qint32 degStringToMicrodeg(const QString °rees)
Convert an angle from a QString (in degrees) to an integer (in microdegrees)
Definition: angle.cpp:140
Angle operator*(const Angle &rhs) const
Definition: angle.h:375
bool operator!=(const Angle &rhs) const
Definition: angle.h:406
qint32 mMicrodegrees
the angle in microdegrees
Definition: angle.h:430
bool operator>=(const Angle &rhs) const
Definition: angle.h:394
Angle operator/(qint32 rhs) const
Definition: angle.h:382
Angle(const Angle &angle) noexcept
Copy Constructor.
Definition: angle.h:92
static Angle deg225() noexcept
225 degrees
Definition: angle.h:351
Angle operator-() const
Definition: angle.h:371
static Angle fromRad(qreal radians) noexcept
Get an Angle object with a specific angle.
Definition: angle.cpp:132
bool operator<=(qint32 rhs) const
Definition: angle.h:401
Angle & mapTo180deg() noexcept
Map this Angle object to [-180..+180[ degrees.
Definition: angle.cpp:110
bool operator<=(const Angle &rhs) const
Definition: angle.h:398
static Angle deg45() noexcept
45 degrees
Definition: angle.h:347
Angle abs() const noexcept
Get an Angle object with absolute value (mMicrodegrees >= 0)
Definition: angle.cpp:49
bool operator>(qint32 rhs) const
Definition: angle.h:389
void setAngleDeg(const QString °rees)
Set the angle in degrees, represented in a QString.
Definition: angle.h:143
static Angle deg270() noexcept
270 degrees
Definition: angle.h:352
Angle(qint32 microdegrees) noexcept
Constructor with an angle in microdegrees.
Definition: angle.h:99
Angle operator-(const Angle &rhs) const
Definition: angle.h:372
bool operator>=(qint32 rhs) const
Definition: angle.h:397
Angle inverted() const noexcept
Get an Angle object with inverted value.
Definition: angle.cpp:60
std::tuple< Angle, Angle, Angle > Angle3D
Definition: angle.h:455
Angle rounded(const Angle &interval) const noexcept
Get an Angle object rounded to a given interval.
Definition: angle.cpp:75
qint32 toMicroDeg() const noexcept
Get the angle in microdegrees.
Definition: angle.h:169
uint qHash(const AttributeKey &key, uint seed=0) noexcept
Definition: attributekey.h:118
Angle & operator-=(const Angle &rhs)
Definition: angle.h:364
Angle operator%(const Angle &rhs) const
Definition: angle.h:383
bool operator<(const Angle &rhs) const
Definition: angle.h:390