Apollo 10.0
自动驾驶开放平台
|
The Angle class uses an integer to represent an angle, and supports commonly-used operations such as addition and subtraction, as well as the use of trigonometric functions. 更多...
#include <angle.h>
Public 成员函数 | |
Angle (const T value=0) | |
Constructs an Angle object from raw internal value. | |
T | raw () const |
Getter of value_. | |
double | to_deg () const |
Converts the internal representation to degrees. | |
double | to_rad () const |
Converts the internal representation to radians. | |
Angle | operator+= (Angle other) |
Sums another angle to the current one. | |
Angle | operator-= (Angle other) |
Subtracts another angle from the current one. | |
template<typename Scalar > | |
Angle | operator*= (Scalar s) |
Multiplies angle by scalar | |
template<typename Scalar > | |
Angle | operator/= (Scalar s) |
Divides angle by scalar | |
静态 Public 成员函数 | |
static Angle | from_deg (const double value) |
Constructs an Angle object from an angle in degrees (factory). | |
static Angle | from_rad (const double value) |
Constructs an Angle object from an angle in radians (factory). | |
静态 Public 属性 | |
static constexpr T | RAW_PI = std::numeric_limits<T>::min() |
Internal representation of pi | |
static constexpr T | RAW_PI_2 |
Internal representation of pi/2 | |
static constexpr double | DEG_TO_RAW = RAW_PI / -180.0 |
Used for converting angle units | |
static constexpr double | RAD_TO_RAW = RAW_PI * -M_1_PI |
Used for converting angle units | |
static constexpr double | RAW_TO_DEG = -180.0 / RAW_PI |
Used for converting angle units | |
static constexpr double | RAW_TO_RAD = -M_PI / RAW_PI |
Used for converting angle units | |
The Angle class uses an integer to represent an angle, and supports commonly-used operations such as addition and subtraction, as well as the use of trigonometric functions.
Having a specialized Angle class prevents code repetition, namely for tasks such as computing angle differences or finding equivalent angles in some specified interval, typically [-pi, pi). Representing angles by integers has the following advantages: 1) Finer level of precision control (< means "less precise than"): Angle8 < Angle16 < float < Angle32 < double < Angle64. 2) Angle8 and Angle16 allow super fast trigonometric functions via a 64-KiB lookup table. 3) Higher precision with the same representation size. The use of the Angle class is encouraged. In particular, Angle32 should be used for latitude/longitude (<1cm error). Angle16 is precise enough for localization/object detection.
T | signed integer type |
|
inlineexplicit |
|
inlinestatic |
Constructs an Angle object from an angle in degrees (factory).
value | Angle in degrees |
|
inlinestatic |
Constructs an Angle object from an angle in radians (factory).
value | Angle in radians |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Converts the internal representation to degrees.
|
inline |
Converts the internal representation to radians.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |