From c0170c01857e713869983dedf084be393924f6db Mon Sep 17 00:00:00 2001 From: pxalcantara Date: Fri, 17 Jul 2020 21:11:09 -0300 Subject: [PATCH] Change doxygen and Max, Min comparison. Signed-off-by: pxalcantara --- include/ignition/math/Vector2.hh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/ignition/math/Vector2.hh b/include/ignition/math/Vector2.hh index f9d28a466..478c3683f 100644 --- a/include/ignition/math/Vector2.hh +++ b/include/ignition/math/Vector2.hh @@ -138,24 +138,20 @@ namespace ignition /// \brief Set this vector's components to the maximum of itself and the /// passed in vector - /// \return[in] _v the maximum clamping vector + /// \param[in] _v the maximum clamping vector public: void Max(const Vector2 &_v) { - if (_v[0] > this->data[0]) - this->data[0] = _v[0]; - if (_v[1] > this->data[1]) - this->data[1] = _v[1]; + this->data[0] = std::max(_v[0], this->data[0]); + this->data[1] = std::max(_v[1], this->data[1]); } /// \brief Set this vector's components to the minimum of itself and the /// passed in vector - /// \return[in] _v the minimum clamping vector + /// \param[in] _v the minimum clamping vector public: void Min(const Vector2 &_v) { - if (_v[0] < this->data[0]) - this->data[0] = _v[0]; - if (_v[1] < this->data[1]) - this->data[1] = _v[1]; + this->data[0] = std::min(_v[0], this->data[0]); + this->data[1] = std::min(_v[1], this->data[1]); } /// \brief Get the maximum value in the vector