mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 07:23:26 +00:00
added explicit constructor for angle and comment for angle
This commit is contained in:
@@ -19,7 +19,7 @@ namespace omath
|
|||||||
class Angle
|
class Angle
|
||||||
{
|
{
|
||||||
Type m_angle;
|
Type m_angle;
|
||||||
constexpr Angle(const Type& degrees)
|
constexpr explicit Angle(const Type& degrees)
|
||||||
{
|
{
|
||||||
if constexpr (flags == AngleFlags::Normalized)
|
if constexpr (flags == AngleFlags::Normalized)
|
||||||
m_angle = angles::WrapAngle(degrees, min, max);
|
m_angle = angles::WrapAngle(degrees, min, max);
|
||||||
@@ -36,7 +36,7 @@ namespace omath
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr static Angle FromDegrees(const Type& degrees)
|
constexpr static Angle FromDegrees(const Type& degrees)
|
||||||
{
|
{
|
||||||
return {degrees};
|
return Angle{degrees};
|
||||||
}
|
}
|
||||||
constexpr Angle() : m_angle(0)
|
constexpr Angle() : m_angle(0)
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ namespace omath
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr static Angle FromRadians(const Type& degrees)
|
constexpr static Angle FromRadians(const Type& degrees)
|
||||||
{
|
{
|
||||||
return {angles::RadiansToDegrees<Type>(degrees)};
|
return Angle{angles::RadiansToDegrees<Type>(degrees)};
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
@@ -146,7 +146,7 @@ namespace omath
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr Angle operator-() const
|
constexpr Angle operator-() const
|
||||||
{
|
{
|
||||||
return {-m_angle};
|
return Angle{-m_angle};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,16 @@
|
|||||||
|
|
||||||
namespace omath
|
namespace omath
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
|\
|
||||||
|
| \
|
||||||
|
a | \ hypot
|
||||||
|
| \
|
||||||
|
-----
|
||||||
|
b
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
template<class Vector>
|
template<class Vector>
|
||||||
class Triangle final
|
class Triangle final
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user