diff --git a/src/modm/math/geometry/line_2d_impl.hpp b/src/modm/math/geometry/line_2d_impl.hpp index 80e9cd55eb..29f556c939 100644 --- a/src/modm/math/geometry/line_2d_impl.hpp +++ b/src/modm/math/geometry/line_2d_impl.hpp @@ -66,7 +66,7 @@ modm::Line2D::getDistanceTo(const Vector& point) const FloatType d = c1 / c2; // calculate the closest point - Vector closestPoint = this->point + this->directionVector * d; + const Vector closestPoint = this->point + this->directionVector * d; // return the length of the vector from the closest point on the line // to the given point diff --git a/src/modm/math/geometry/location_2d.hpp b/src/modm/math/geometry/location_2d.hpp index d71c2f7643..f38295135b 100644 --- a/src/modm/math/geometry/location_2d.hpp +++ b/src/modm/math/geometry/location_2d.hpp @@ -68,6 +68,7 @@ namespace modm std::abs(orientation - other.orientation) < __FLT_EPSILON__ ); } + // TODO chris: implement this in terms of !(*this == other)? bool operator!= (const Location2D &other) const { return ( position != other.position or diff --git a/src/modm/math/geometry/vector.hpp b/src/modm/math/geometry/vector.hpp index 9df887a5e3..be6fab50ea 100644 --- a/src/modm/math/geometry/vector.hpp +++ b/src/modm/math/geometry/vector.hpp @@ -94,7 +94,7 @@ class Vector : public std::array template constexpr Vector(Args... args) { - // Not sure if perfect forwarding is required here !? + // Not yet sure if perfect forwarding is required here !? studying... // assign<0>(std::forward(args)...); assign<0>(args...); } @@ -370,7 +370,7 @@ class Vector : public std::array template constexpr TR getLength() const - { return modm::round_smart(std::sqrt(getLengthSquared())); } + { return modm::round_smart(std::sqrt(getLengthSquared())); } constexpr WideType getDistanceTo(const Vector& other) const { return (other - *this).getLength(); } @@ -502,9 +502,9 @@ operator<<(IOStream &os, const Vector &v) * This definition is useful for inclusion or intersection testing. */ template -int8_t +constexpr int8_t ccw(Vector a, Vector b, Vector c) { - using WideType = std::conditional, T, modm::WideType>::type; + using WideType = modm::WideType; const Vector v1 = b - a; const Vector v2 = c - a; diff --git a/src/modm/math/matrix.hpp b/src/modm/math/matrix.hpp index 0d90f5bc81..4132394df0 100644 --- a/src/modm/math/matrix.hpp +++ b/src/modm/math/matrix.hpp @@ -55,7 +55,7 @@ namespace modm static constexpr std::size_t ColumnCount = COLUMNS; static constexpr std::size_t ElementCount = RowCount * ColumnCount; - T element[ElementCount]; + T element[ElementCount]{}; /** * \brief Default Constructor diff --git a/src/modm/math/utils/integer_traits.hpp b/src/modm/math/utils/integer_traits.hpp index 0c7bc1b232..ac53a0b3b7 100644 --- a/src/modm/math/utils/integer_traits.hpp +++ b/src/modm/math/utils/integer_traits.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Thomas Sommer + * Copyright (c) 2021-2022, Thomas Sommer * * This file is part of the modm project. * @@ -73,8 +73,8 @@ template * @brief Simple function that only applies std::round * when a float/double is assigned to an integral * - * @tparam TA Type of argument * @tparam TR Type of return + * @tparam TA Type of argument */ template