FluxSand 1.0
FluxSand - Interactive Digital Hourglass
|
A class to represent and manipulate cyclic values (e.g., angles). More...
#include <comp_type.hpp>
Public Member Functions | |
CycleValue & | operator= (const CycleValue &)=default |
Default copy assignment operator. | |
CycleValue (const float &value) | |
Constructs a CycleValue object from a float. | |
CycleValue (const double &value) | |
Constructs a CycleValue object from a double. | |
CycleValue (const CycleValue &value) | |
Copy constructor. Ensures the copied value remains within [0, 2π). | |
CycleValue () | |
Default constructor. Initializes the value to 0. | |
CycleValue | operator+ (const float &value) |
Adds a float value and returns the resulting CycleValue. | |
CycleValue | operator+ (const double &value) |
Adds a double value and returns the resulting CycleValue. | |
CycleValue | operator+ (const CycleValue &value) |
Adds another CycleValue and returns the result. | |
CycleValue | operator+= (const float &value) |
In-place addition of a float value. | |
CycleValue | operator+= (const double &value) |
In-place addition of a double value. | |
CycleValue | operator+= (const CycleValue &value) |
In-place addition of another CycleValue. | |
float | operator- (const float &raw_value) |
Computes the difference between this value and a float value. | |
float | operator- (const double &raw_value) |
Computes the difference between this value and a double value. | |
float | operator- (const CycleValue &value) |
Computes the difference between this value and another CycleValue. | |
CycleValue | operator- () |
Negates the current value. | |
operator float () | |
Implicit conversion to float. | |
CycleValue & | operator= (const float &value) |
Assigns a float value. | |
CycleValue & | operator= (const double &value) |
Assigns a double value. | |
float | Value () |
Returns the current value. | |
Static Public Member Functions | |
static float | Calculate (float value) |
Normalizes a value to the range [0, 2π). | |
Private Attributes | |
float | value_ |
A class to represent and manipulate cyclic values (e.g., angles).
This class ensures that values remain within a cyclic range, such as [0, 2π), and provides arithmetic operations while preserving this property.
Definition at line 13 of file comp_type.hpp.
|
inline |
Constructs a CycleValue object from a float.
value | The input value. |
Definition at line 39 of file comp_type.hpp.
|
inline |
Constructs a CycleValue object from a double.
value | The input value. |
Definition at line 46 of file comp_type.hpp.
|
inline |
Copy constructor. Ensures the copied value remains within [0, 2π).
value | Another CycleValue object. |
Definition at line 54 of file comp_type.hpp.
|
inline |
Default constructor. Initializes the value to 0.
Definition at line 67 of file comp_type.hpp.
|
inlinestatic |
Normalizes a value to the range [0, 2π).
value | The input value (in radians). |
Definition at line 26 of file comp_type.hpp.
|
inline |
Implicit conversion to float.
Definition at line 203 of file comp_type.hpp.
|
inline |
Adds another CycleValue and returns the result.
value | Another CycleValue object. |
Definition at line 95 of file comp_type.hpp.
|
inline |
Adds a double value and returns the resulting CycleValue.
value | The value to add. |
Definition at line 85 of file comp_type.hpp.
|
inline |
Adds a float value and returns the resulting CycleValue.
value | The value to add. |
Definition at line 75 of file comp_type.hpp.
|
inline |
In-place addition of another CycleValue.
value | Another CycleValue object. |
Definition at line 127 of file comp_type.hpp.
|
inline |
In-place addition of a double value.
value | The value to add. |
Definition at line 116 of file comp_type.hpp.
|
inline |
In-place addition of a float value.
value | The value to add. |
Definition at line 105 of file comp_type.hpp.
|
inline |
Negates the current value.
Definition at line 196 of file comp_type.hpp.
|
inline |
Computes the difference between this value and another CycleValue.
value | Another CycleValue object. |
Definition at line 178 of file comp_type.hpp.
|
inline |
Computes the difference between this value and a double value.
raw_value | The value to subtract. |
Definition at line 158 of file comp_type.hpp.
|
inline |
Computes the difference between this value and a float value.
raw_value | The value to subtract. |
Definition at line 138 of file comp_type.hpp.
|
inline |
Assigns a double value.
value | The value to assign. |
Definition at line 222 of file comp_type.hpp.
|
inline |
Assigns a float value.
value | The value to assign. |
Definition at line 211 of file comp_type.hpp.
|
inline |
Returns the current value.
Definition at line 232 of file comp_type.hpp.
|
private |
Definition at line 235 of file comp_type.hpp.