Skip to content
Snippets Groups Projects
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 eclipse/simopenpass/scenario_api!21
parents 61e1a43a 2b38c9c8
No related branches found
No related tags found
1 merge request!21Add unary minus operator to vector
...@@ -24,11 +24,23 @@ namespace mantle_api ...@@ -24,11 +24,23 @@ namespace mantle_api
template <typename T, class = typename std::enable_if_t<units::traits::is_unit_t<T>::value>> template <typename T, class = typename std::enable_if_t<units::traits::is_unit_t<T>::value>>
struct Vec3 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 x{0};
T y{0}; T y{0};
T z{0}; T z{0};
inline T Length() const { return units::math::sqrt((x * x) + (y * y) + (z * z)); } 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> template <typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment