From 01f6553fd66d385ca96960ed08f0635149671d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 19 Nov 2013 20:30:25 +0100 Subject: [PATCH] Math: simplified Vector*::*Axis() and Vector*::*Scale() functions. --- src/Math/Vector2.h | 8 ++++---- src/Math/Vector3.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Math/Vector2.h b/src/Math/Vector2.h index 5f7d31968..0d77e00e4 100644 --- a/src/Math/Vector2.h +++ b/src/Math/Vector2.h @@ -51,7 +51,7 @@ template class Vector2: public Vector<2, T> { * @endcode * @see yAxis(), xScale(), Matrix3::right() */ - constexpr static Vector2 xAxis(T length = T(1)) { return Vector2(length, T()); } + constexpr static Vector2 xAxis(T length = T(1)) { return {length, T(0)}; } /** * @brief %Vector in direction of Y axis (up) @@ -59,7 +59,7 @@ template class Vector2: public Vector<2, T> { * See xAxis() for more information. * @see yScale(), Matrix3::up() */ - constexpr static Vector2 yAxis(T length = T(1)) { return Vector2(T(), length); } + constexpr static Vector2 yAxis(T length = T(1)) { return {T(0), length}; } /** * @brief Scaling vector in direction of X axis (width) @@ -70,7 +70,7 @@ template class Vector2: public Vector<2, T> { * @endcode * @see yScale(), xAxis() */ - constexpr static Vector2 xScale(T scale) { return Vector2(scale, T(1)); } + constexpr static Vector2 xScale(T scale) { return {scale, T(1)}; } /** * @brief Scaling vector in direction of Y axis (height) @@ -78,7 +78,7 @@ template class Vector2: public Vector<2, T> { * See xScale() for more information. * @see yAxis() */ - constexpr static Vector2 yScale(T scale) { return Vector2(T(1), scale); } + constexpr static Vector2 yScale(T scale) { return {T(1), scale}; } /** * @brief 2D cross product diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index 4da38e208..ea1ff8411 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -53,7 +53,7 @@ template class Vector3: public Vector<3, T> { * @endcode * @see yAxis(), zAxis(), xScale(), Matrix4::right() */ - constexpr static Vector3 xAxis(T length = T(1)) { return Vector3(length, T(), T()); } + constexpr static Vector3 xAxis(T length = T(1)) { return {length, T(), T()}; } /** * @brief %Vector in direction of Y axis (up) @@ -61,7 +61,7 @@ template class Vector3: public Vector<3, T> { * See xAxis() for more information. * @see yScale(), Matrix4::up() */ - constexpr static Vector3 yAxis(T length = T(1)) { return Vector3(T(), length, T()); } + constexpr static Vector3 yAxis(T length = T(1)) { return {T(), length, T()}; } /** * @brief %Vector in direction of Z axis (backward) @@ -69,7 +69,7 @@ template class Vector3: public Vector<3, T> { * See xAxis() for more information. * @see zScale(), Matrix4::backward() */ - constexpr static Vector3 zAxis(T length = T(1)) { return Vector3(T(), T(), length); } + constexpr static Vector3 zAxis(T length = T(1)) { return {T(), T(), length}; } /** * @brief Scaling vector in direction of X axis (width) @@ -80,7 +80,7 @@ template class Vector3: public Vector<3, T> { * @endcode * @see yScale(), zScale(), xAxis() */ - constexpr static Vector3 xScale(T scale) { return Vector3(scale, T(1), T(1)); } + constexpr static Vector3 xScale(T scale) { return {scale, T(1), T(1)}; } /** * @brief Scaling vector in direction of Y axis (height) @@ -88,7 +88,7 @@ template class Vector3: public Vector<3, T> { * See xScale() for more information. * @see yAxis() */ - constexpr static Vector3 yScale(T scale) { return Vector3(T(1), scale, T(1)); } + constexpr static Vector3 yScale(T scale) { return {T(1), scale, T(1)}; } /** * @brief Scaling vector in direction of Z axis (depth) @@ -96,7 +96,7 @@ template class Vector3: public Vector<3, T> { * See xScale() for more information. * @see zAxis() */ - constexpr static Vector3 zScale(T scale) { return Vector3(T(1), T(1), scale); } + constexpr static Vector3 zScale(T scale) { return {T(1), T(1), scale}; } /** * @brief Cross product