libxr 1.0
Want to be the best embedded framework
|
角度循环处理类,用于处理周期性角度计算。 A cyclic angle handling class for periodic angle calculations. More...
#include <cycle_value.hpp>
Public Member Functions | |
CycleValue & | operator= (const CycleValue &)=default |
赋值运算符重载。 Overloaded assignment operator. | |
CycleValue (const Scalar &value) | |
使用给定值初始化 CycleValue 。 Initializes CycleValue with a given value. | |
CycleValue (const CycleValue &value) | |
拷贝构造函数,确保角度值在合法范围内。 Copy constructor ensuring the angle value remains within valid limits. | |
CycleValue () | |
默认构造函数,初始化为 0。 Default constructor initializing the angle to 0. | |
CycleValue | operator+ (const Scalar &value) |
加法运算符重载。 Overloaded addition operator. | |
CycleValue | operator+ (const CycleValue &value) |
CycleValue | operator+= (const Scalar &value) |
复合加法运算符重载。 Overloaded compound addition operator. | |
CycleValue | operator+= (const CycleValue &value) |
Scalar | operator- (const Scalar &raw_value) |
减法运算符重载,计算角度差值并归一化到 -π 到 π 之间。 Overloaded subtraction operator, computing the angle difference and normalizing it to -π to π . | |
Scalar | operator- (const CycleValue &value) |
CycleValue | operator-= (const Scalar &value) |
复合减法运算符重载。 Overloaded compound subtraction operator. | |
CycleValue | operator-= (const CycleValue &value) |
CycleValue | operator- () |
取反运算符重载,将角度转换到 2π - value_ 。 Overloaded negation operator, converting the angle to 2π - value_ . | |
operator Scalar () | |
类型转换操作符,将 CycleValue 转换为 Scalar 。 Type conversion operator to convert CycleValue to Scalar . | |
CycleValue & | operator= (const Scalar &value) |
赋值运算符重载,更新角度值并归一化。 Overloaded assignment operator, updating and normalizing the angle value. | |
Scalar | Value () |
获取当前的角度值。 Retrieves the current angle value. | |
Static Public Member Functions | |
static Scalar | Calculate (Scalar value) |
计算角度值并归一化到 0 到 2π 之间。 Computes and normalizes the angle value within the range of 0 to 2π. | |
Private Attributes | |
Scalar | value_ |
存储的角度值。 The stored angle value. | |
角度循环处理类,用于处理周期性角度计算。 A cyclic angle handling class for periodic angle calculations.
该类用于处理 0 到 2π 之间的角度运算,确保角度始终保持在合法范围内, 并提供加减运算和类型转换功能。 This class handles angle calculations within the range of 0 to 2π, ensuring values stay within valid limits and supporting addition, subtraction, and type conversion operations.
Scalar | 角度的存储类型,默认为 DefaultScalar 。 The storage type for angles, default is DefaultScalar . |
Definition at line 26 of file cycle_value.hpp.
|
inline |
使用给定值初始化 CycleValue
。 Initializes CycleValue
with a given value.
value | 需要存储的角度值。 The angle value to be stored. |
Definition at line 67 of file cycle_value.hpp.
|
inline |
拷贝构造函数,确保角度值在合法范围内。 Copy constructor ensuring the angle value remains within valid limits.
value | 另一个 CycleValue 对象。 Another CycleValue object. |
Definition at line 76 of file cycle_value.hpp.
|
inline |
默认构造函数,初始化为 0。 Default constructor initializing the angle to 0.
Definition at line 93 of file cycle_value.hpp.
|
inlinestatic |
计算角度值并归一化到 0 到 2π 之间。 Computes and normalizes the angle value within the range of 0 to 2π.
value | 输入角度值。 The input angle value. |
Definition at line 50 of file cycle_value.hpp.
|
inline |
类型转换操作符,将 CycleValue
转换为 Scalar
。 Type conversion operator to convert CycleValue
to Scalar
.
Scalar
形式返回角度值。 Returns the angle value as Scalar
. Definition at line 234 of file cycle_value.hpp.
|
inline |
Definition at line 106 of file cycle_value.hpp.
|
inline |
加法运算符重载。 Overloaded addition operator.
value | 需要加上的角度值。 The angle value to be added. |
CycleValue
对象。 Returns a new CycleValue
object. Definition at line 104 of file cycle_value.hpp.
|
inline |
|
inline |
|
inline |
取反运算符重载,将角度转换到 2π - value_
。 Overloaded negation operator, converting the angle to 2π - value_
.
CycleValue
。 Returns the negated CycleValue
. Definition at line 225 of file cycle_value.hpp.
|
inline |
|
inline |
减法运算符重载,计算角度差值并归一化到 -π
到 π
之间。 Overloaded subtraction operator, computing the angle difference and normalizing it to -π
to π
.
raw_value | 需要减去的角度值。 The angle value to be subtracted. |
Definition at line 153 of file cycle_value.hpp.
|
inline |
|
inline |
|
default |
赋值运算符重载。 Overloaded assignment operator.
赋值运算符默认使用编译器生成的实现。 The assignment operator uses the default compiler-generated implementation.
CycleValue
对象。 Returns the assigned CycleValue
object.
|
inline |
赋值运算符重载,更新角度值并归一化。 Overloaded assignment operator, updating and normalizing the angle value.
value | 需要赋值的新角度值。 The new angle value to be assigned. |
Definition at line 245 of file cycle_value.hpp.
|
inline |
获取当前的角度值。 Retrieves the current angle value.
Definition at line 258 of file cycle_value.hpp.
|
private |
存储的角度值。 The stored angle value.
Definition at line 261 of file cycle_value.hpp.