33#include <NDEVR/BaseValues.h>
34#include <NDEVR/ObjectInfo.h>
79 template<
class t_
float_type>
80 static constexpr t_float_type PI()
91 template<
class t_type = fltp08>
113 template<
class t_other_type>
158 constexpr explicit Angle(t_type value)
168 template<AngleType t_angle_type>
171 switch (t_angle_type)
210 template<
bool t_normalized>
213 if constexpr(t_normalized)
225 template<
class t_new_type>
293 template<
class t_value_type>
304 template<
class t_value_type>
315 template<
class t_value_type>
327 template<
class t_value_type>
336 template<
class t_normal_type>
337 static constexpr typename std::enable_if<!ObjectInfo<t_normal_type>::Float, t_normal_type>::type NormalizeInternal(t_normal_type value)
339 const t_normal_type angle = (value >= 0 ? value : -value) % (2 *
INDEX_PI);
346 template<
class t_normal_type>
347 static constexpr typename std::enable_if<ObjectInfo<t_normal_type>::Float, t_normal_type>::type NormalizeInternal(t_normal_type value)
349 const t_normal_type angle = fmod(std::abs(value), (2 *
INDEX_PI));
368 template<
class t_type>
371 return IsInvalid(value.template internal<false>());
374 template<
class t_to,
class t_from>
383 struct ObjectInfo<Angle<
sint04>, false, false>
385 static const uint01 Dimensions = 0;
386 static const bool Vector =
false;
387 static const bool Primitive =
true;
388 static const bool Pointer =
false;
389 static const bool Unsigned =
false;
390 static const bool Float =
true;
391 static const bool Integer =
false;
392 static const bool Number =
true;
393 static const bool String =
false;
394 static const bool Color =
false;
395 static const bool Buffer =
false;
396 static const bool Boolean =
false;
397 static constexpr ObjectInfo<Angle<sint04>,
false,
false> VectorSub() {
return ObjectInfo<Angle<sint04>,
false,
false>(); }
403 struct ObjectInfo<Angle<
fltp08>, false, false>
405 static const uint01 Dimensions = 0;
406 static const bool Vector =
false;
407 static const bool Primitive =
true;
408 static const bool Pointer =
false;
409 static const bool Unsigned =
false;
410 static const bool Float =
true;
411 static const bool Integer =
false;
412 static const bool Number =
true;
413 static const bool String =
false;
414 static const bool Color =
false;
415 static const bool Buffer =
false;
416 static const bool Boolean =
false;
417 static constexpr ObjectInfo<Angle<fltp08>,
false,
false> VectorSub() {
return ObjectInfo<Angle<fltp08>,
false,
false>(); }
423 struct ObjectInfo<Angle<
fltp04>, false, false>
425 static const uint01 Dimensions = 0;
426 static const bool Vector =
false;
427 static const bool Primitive =
true;
428 static const bool Pointer =
false;
429 static const bool Unsigned =
false;
430 static const bool Float =
true;
431 static const bool Integer =
false;
432 static const bool Number =
true;
433 static const bool String =
false;
434 static const bool Color =
false;
435 static const bool Buffer =
false;
436 static const bool Boolean =
false;
437 static constexpr ObjectInfo<Angle<fltp04>,
false,
false> VectorSub() {
return ObjectInfo<Angle<fltp04>,
false,
false>(); }
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
t_type m_index_angle
Definition Angle.h:358
static Angle asin(t_value_type value)
Computes the principal value of the arc sine of the given value.
Definition Angle.h:305
constexpr t_type internal() const
Gets the internal index angle which is the default storage unit for the angle data.
Definition Angle.h:211
constexpr Angle(AngleType type, fltp04 value)
Angle Constructor.
Definition Angle.h:123
constexpr Angle< t_new_type > toTypeAngle() const
Explicit conversion of an angle from one container type to another.
Definition Angle.h:226
constexpr Angle normalizedOffset() const
returns the normalized angle which lies from -180 to 180 degrees.
Definition Angle.h:241
constexpr Angle()
Default constructor, creates an angle with 0 degrees.
Definition Angle.h:99
constexpr Angle(const Angle &angle)
Default copy constructor.
Definition Angle.h:106
static Angle atan2(t_value_type x, t_value_type y)
measures the counterclockwise angle between the positive x-axis and the point (x, y)
Definition Angle.h:328
constexpr Angle normalized() const
returns the normalized angle which lies from 0 to 360 degrees.
Definition Angle.h:234
constexpr Angle & operator=(const Angle &angle)
Definition Angle.h:252
constexpr Angle(const Angle< t_other_type > &angle)
Explicit conversion of an angle from one container type to another.
Definition Angle.h:114
static constexpr fltp08 INV_INDEX_PI
Definition Angle.h:334
static Angle acos(t_value_type value)
Computes the principal value of the arc cosine of the given value.
Definition Angle.h:294
Angle operator-() const
negates the angle
Definition Angle.h:282
constexpr bool operator!=(const Angle &angle) const
Inequality operator.
Definition Angle.h:273
constexpr fltp08 as(AngleType type) const
Returns a form of this angle as a given type (Radian, Degree, Percent, etc)
Definition Angle.h:193
static Angle atan(t_value_type value)
Computes the principal value of the arc tangent of the given value.
Definition Angle.h:316
constexpr bool operator==(const Angle &angle) const
Equality operator.
Definition Angle.h:263
constexpr Angle(AngleType type, fltp08 value)
Angle Constructor.
Definition Angle.h:141
static constexpr sint04 INDEX_PI
Definition Angle.h:333
constexpr Angle(t_type value)
Constructor.
Definition Angle.h:158
constexpr fltp08 as() const
Returns a form of this angle as a given type (Radian, Degree, Percent, etc) The template t_type provi...
Definition Angle.h:169
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:64
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
Definition BaseValues.hpp:127
EulerPosition
Values that represent euler angles. These are typically used in Vector<3, Angle> to classify an orien...
Definition Angle.h:44
@ ROLL
Definition Angle.h:45
@ YAW
Definition Angle.h:47
@ PITCH
Definition Angle.h:46
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
AngleType
The possible units that can be used by the angle class. These are returned and used for real world an...
Definition Angle.h:56
@ PERCENT
Definition Angle.h:60
@ RADIANS
Definition Angle.h:57
@ DEGREES
Definition Angle.h:58
@ INTERNAL_ANGLE
Definition Angle.h:59
AngleFormatMode
Values that represent angle format modes. Used in classes for printing angle in a given format.
Definition Angle.h:68
@ MODE_DEGREES_MINUTES_SECONDS
Definition Angle.h:70
@ MODE_GRADIANS
Definition Angle.h:71
@ MODE_RADIANS
Definition Angle.h:72
@ MODE_SURVEYOR_UNITS
Definition Angle.h:73
@ MODE_DECIMAL_DEGREES
Definition Angle.h:69
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233