Skip to content

Commit c7e48fa

Browse files
committed
destille to single header
1 parent c9c1de5 commit c7e48fa

24 files changed

+1255
-2043
lines changed

src/modm/math/geometry/line_2d_impl.hpp

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

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

8484
// return the length of the vector from the closest point on the line
8585
// to the given point

src/modm/math/geometry/line_segment_2d_impl.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ template<typename T>
161161
bool
162162
modm::LineSegment2D<T>::intersects(const LineSegment2D<T>& other) const
163163
{
164-
return (((Vector<T, 2>::ccw(this->startPoint, this->endPoint, other.startPoint) *
165-
Vector<T, 2>::ccw(this->startPoint, this->endPoint, other.endPoint)) <= 0) &&
166-
((Vector<T, 2>::ccw(other.startPoint, other.endPoint, this->startPoint) *
167-
Vector<T, 2>::ccw(other.startPoint, other.endPoint, this->endPoint)) <= 0));
164+
return (((modm::ccw(this->startPoint, this->endPoint, other.startPoint) *
165+
modm::ccw(this->startPoint, this->endPoint, other.endPoint)) <= 0) &&
166+
((modm::ccw(other.startPoint, other.endPoint, this->startPoint) *
167+
modm::ccw(other.startPoint, other.endPoint, this->endPoint)) <= 0));
168168
}
169169

170170
// ----------------------------------------------------------------------------

src/modm/math/geometry/location_2d.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ namespace modm
5454
void setPosition(const Vector<T, 2>& position) { this->position = position; }
5555

5656
[[deprecated("Use 'setPosition({x, y}' instead!")]]
57-
void setPosition(T x, T y) { this->position.x = x; this->position.y = y; }
57+
void setPosition(T x, T y) { this->position.x() = x; this->position.y() = y; }
5858
void setOrientation(const float orientation) { this->orientation = orientation; }
5959

6060
Vector<T, 2> getPosition() const { return position; }
6161
inline float getOrientation() const { return orientation; }
62-
T getX() const { return position.x; }
63-
T getY() const { return position.y; }
62+
T getX() const { return position.x(); }
63+
T getY() const { return position.y(); }
6464

6565
bool operator== (const Location2D &other) const {
6666
return (

src/modm/math/geometry/polygon_2d.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define MODM_POLYGON_2D_HPP
1616

1717
#include "point_set_2d.hpp"
18-
#include "vector2.hpp"
18+
#include "vector.hpp"
1919

2020
namespace modm
2121
{

src/modm/math/geometry/polygon_2d_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ modm::Polygon2D<T>::isInside(const modm::Polygon2D<T>::PointType& point)
161161

162162
SizeType n = this->points.getSize();
163163
for (SizeType i = 0; i < n; ++i) {
164-
int_fast8_t r = Vector<T, 2>::ccw(this->points[i], this->points[(i + 1) % n], point);
164+
int_fast8_t r = modm::ccw(this->points[i], this->points[(i + 1) % n], point);
165165

166166
switch (r) {
167167
case 0:

src/modm/math/geometry/quaternion.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace modm
2020
{
2121
// forward declaration
2222
template<class T, std::size_t N>
23+
requires (N > 0)
2324
class Vector;
2425

2526
template<class T, std::size_t ROWS, std::size_t COLUMNS>

0 commit comments

Comments
 (0)