Skip to content

Commit

Permalink
Treat review by chris-durand
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Feb 14, 2022
1 parent 05f9da5 commit bf3e15e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/modm/math/geometry/line_2d_impl.hpp
Expand Up @@ -66,7 +66,7 @@ modm::Line2D<T>::getDistanceTo(const Vector<T, 2>& point) const
FloatType d = c1 / c2;

// calculate the closest point
Vector<T, 2> closestPoint = this->point + this->directionVector * d;
const Vector<T, 2> closestPoint = this->point + this->directionVector * d;

// return the length of the vector from the closest point on the line
// to the given point
Expand Down
1 change: 1 addition & 0 deletions src/modm/math/geometry/location_2d.hpp
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/modm/math/geometry/vector.hpp
Expand Up @@ -96,7 +96,7 @@ class Vector : public std::array<T, N>
template <class... Args>
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>(args)...);
assign<0>(args...);
}
Expand Down Expand Up @@ -372,7 +372,7 @@ class Vector : public std::array<T, N>

template<typename TR = T>
constexpr TR getLength() const
{ return modm::round_smart<TR, decltype(std::sqrt(getLengthSquared()))>(std::sqrt(getLengthSquared())); }
{ return modm::round_smart<TR>(std::sqrt(getLengthSquared())); }

constexpr WideType getDistanceTo(const Vector& other) const
{ return (other - *this).getLength(); }
Expand Down Expand Up @@ -504,9 +504,9 @@ operator<<(IOStream &os, const Vector<U, M> &v)
* This definition is useful for inclusion or intersection testing.
*/
template<typename T>
int8_t
constexpr int8_t
ccw(Vector<T, 2> a, Vector<T, 2> b, Vector<T, 2> c) {
using WideType = std::conditional<std::is_floating_point_v<T>, T, modm::WideType<T>>::type;
using WideType = modm::WideType<T>;

const Vector<WideType, 2> v1 = b - a;
const Vector<WideType, 2> v2 = c - a;
Expand Down
2 changes: 1 addition & 1 deletion src/modm/math/matrix.hpp
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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.
*
Expand Down Expand Up @@ -73,8 +73,8 @@ template <typename ... Ts>
* @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 <typename TR, typename TA>
Expand Down

0 comments on commit bf3e15e

Please sign in to comment.