Commit fa27a11f by Maarten L. Hekkelman

some quaternion additions

parent b0451777
...@@ -54,7 +54,7 @@ class quaternion_type ...@@ -54,7 +54,7 @@ class quaternion_type
public: public:
using value_type = T; using value_type = T;
constexpr explicit quaternion_type(value_type const &value_a = value_type(), value_type const &value_b = value_type(), value_type const &value_c = value_type(), value_type const &value_d = value_type()) constexpr explicit quaternion_type(value_type const &value_a = {}, value_type const &value_b = {}, value_type const &value_c = {}, value_type const &value_d = {})
: a(value_a) : a(value_a)
, b(value_b) , b(value_b)
, c(value_c) , c(value_c)
...@@ -305,6 +305,21 @@ class quaternion_type ...@@ -305,6 +305,21 @@ class quaternion_type
constexpr value_type get_c() const { return c; } constexpr value_type get_c() const { return c; }
constexpr value_type get_d() const { return d; } constexpr value_type get_d() const { return d; }
constexpr bool operator==(const quaternion_type &rhs) const
{
return a == rhs.a and b == rhs.b and c == rhs.c and d == rhs.d;
}
constexpr bool operator!=(const quaternion_type &rhs) const
{
return a != rhs.a or b != rhs.b or c != rhs.c or d != rhs.d;
}
constexpr operator bool() const
{
return operator!=({});
}
private: private:
value_type a, b, c, d; value_type a, b, c, d;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment