Commit bb393c4f authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Merge branch 'feature/add_unary_minus_to_vector' into 'master'

Add unary minus operator to vector

See merge request !21
parents 61e1a43a 2b38c9c8
......@@ -24,11 +24,23 @@ namespace mantle_api
template <typename T, class = typename std::enable_if_t<units::traits::is_unit_t<T>::value>>
struct Vec3
{
Vec3() = default;
Vec3(T x_in, T y_in, T z_in)
: x{x_in}, y{y_in}, z{z_in}
{
}
T x{0};
T y{0};
T z{0};
inline T Length() const { return units::math::sqrt((x * x) + (y * y) + (z * z)); }
inline Vec3<T> operator-() const noexcept
{
return {-x, -y, -z};
}
};
template <typename T>
......
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