5#include "libxr_def.hpp"
10using DefaultScalar = LIBXR_DEFAULT_SCALAR;
25template <
typename Scalar = DefaultScalar>
52 value = std::fmod(value, M_2PI);
156 Scalar ans =
value_ - value;
234 operator Scalar()
const {
return this->
value_; }
角度循环处理类,用于处理周期性角度计算。 A cyclic angle handling class for periodic angle calculations.
CycleValue & operator-=(const Scalar &value)
复合减法运算符重载。 Overloaded compound subtraction operator.
CycleValue & operator=(const CycleValue &)=default
赋值运算符重载。 Overloaded assignment operator.
CycleValue & operator=(const Scalar &value)
赋值运算符重载,更新角度值并归一化。 Overloaded assignment operator, updating and normalizing the angle value.
Scalar Value() const
获取当前的角度值。 Retrieves the current angle value.
Scalar value_
存储的角度值。 The stored angle value.
CycleValue operator-() const
取反运算符重载,将角度转换到 2π - value_。 Overloaded negation operator, converting the angle to 2π - value_.
Scalar operator-(const Scalar &raw_value) const
减法运算符重载,计算角度差值并归一化到 -π 到 π 之间。 Overloaded subtraction operator, computing the angle difference and no...
CycleValue(const CycleValue &value)
拷贝构造函数,确保角度值在合法范围内。 Copy constructor ensuring the angle value remains within valid limits.
CycleValue operator+(const Scalar &value) const
加法运算符重载。 Overloaded addition operator.
CycleValue & operator+=(const Scalar &value)
复合加法运算符重载。 Overloaded compound addition operator.
CycleValue(const Scalar &value)
使用给定值初始化 CycleValue。 Initializes CycleValue with a given value.
CycleValue()
默认构造函数,初始化为 0。 Default constructor initializing the angle to 0.
static constexpr Scalar Calculate(Scalar value)
计算角度值并归一化到 0 到 2π 之间。 Computes and normalizes the angle value within the range of 0 to 2π.