Skip to content

Commit ba50e27

Browse files
committed
Treat review by chris-durand
1 parent 6ba3359 commit ba50e27

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/modm/math/geometry/line_2d_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ modm::Line2D<T>::getDistanceTo(const Vector<T, 2>& point) const
6666
FloatType d = c1 / c2;
6767

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

7171
// return the length of the vector from the closest point on the line
7272
// to the given point

src/modm/math/geometry/location_2d.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ namespace modm
6868
std::abs(orientation - other.orientation) < __FLT_EPSILON__
6969
);
7070
}
71+
// TODO chris: implement this in terms of !(*this == other)?
7172
bool operator!= (const Location2D &other) const {
7273
return (
7374
position != other.position or

src/modm/math/geometry/vector.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Vector : public std::array<T, N>
9494
template <class... Args>
9595
constexpr Vector(Args... args)
9696
{
97-
// Not sure if perfect forwarding is required here !?
97+
// Not yet sure if perfect forwarding is required here !? studying...
9898
// assign<0>(std::forward<Args>(args)...);
9999
assign<0>(args...);
100100
}
@@ -370,7 +370,7 @@ class Vector : public std::array<T, N>
370370

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

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

509509
const Vector<WideType, 2> v1 = b - a;
510510
const Vector<WideType, 2> v2 = c - a;

src/modm/math/matrix.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace modm
5555
static constexpr std::size_t ColumnCount = COLUMNS;
5656
static constexpr std::size_t ElementCount = RowCount * ColumnCount;
5757

58-
T element[ElementCount];
58+
T element[ElementCount]{};
5959

6060
/**
6161
* \brief Default Constructor

src/modm/math/utils/integer_traits.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, Thomas Sommer
2+
* Copyright (c) 2021-2022, Thomas Sommer
33
*
44
* This file is part of the modm project.
55
*
@@ -73,8 +73,8 @@ template <typename ... Ts>
7373
* @brief Simple function that only applies std::round
7474
* when a float/double is assigned to an integral
7575
*
76-
* @tparam TA Type of argument
7776
* @tparam TR Type of return
77+
* @tparam TA Type of argument
7878
7979
*/
8080
template <typename TR, typename TA>

0 commit comments

Comments
 (0)