Skip to content

Commit

Permalink
destille to single header
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Jan 27, 2022
1 parent c9c1de5 commit c7e48fa
Show file tree
Hide file tree
Showing 24 changed files with 1,255 additions and 2,043 deletions.
2 changes: 1 addition & 1 deletion src/modm/math/geometry/line_2d_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,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 + d * this->directionVector;
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
8 changes: 4 additions & 4 deletions src/modm/math/geometry/line_segment_2d_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ template<typename T>
bool
modm::LineSegment2D<T>::intersects(const LineSegment2D<T>& other) const
{
return (((Vector<T, 2>::ccw(this->startPoint, this->endPoint, other.startPoint) *
Vector<T, 2>::ccw(this->startPoint, this->endPoint, other.endPoint)) <= 0) &&
((Vector<T, 2>::ccw(other.startPoint, other.endPoint, this->startPoint) *
Vector<T, 2>::ccw(other.startPoint, other.endPoint, this->endPoint)) <= 0));
return (((modm::ccw(this->startPoint, this->endPoint, other.startPoint) *
modm::ccw(this->startPoint, this->endPoint, other.endPoint)) <= 0) &&
((modm::ccw(other.startPoint, other.endPoint, this->startPoint) *
modm::ccw(other.startPoint, other.endPoint, this->endPoint)) <= 0));
}

// ----------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/modm/math/geometry/location_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ namespace modm
void setPosition(const Vector<T, 2>& position) { this->position = position; }

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

Vector<T, 2> getPosition() const { return position; }
inline float getOrientation() const { return orientation; }
T getX() const { return position.x; }
T getY() const { return position.y; }
T getX() const { return position.x(); }
T getY() const { return position.y(); }

bool operator== (const Location2D &other) const {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/modm/math/geometry/polygon_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define MODM_POLYGON_2D_HPP

#include "point_set_2d.hpp"
#include "vector2.hpp"
#include "vector.hpp"

namespace modm
{
Expand Down
2 changes: 1 addition & 1 deletion src/modm/math/geometry/polygon_2d_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ modm::Polygon2D<T>::isInside(const modm::Polygon2D<T>::PointType& point)

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

switch (r) {
case 0:
Expand Down
1 change: 1 addition & 0 deletions src/modm/math/geometry/quaternion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace modm
{
// forward declaration
template<class T, std::size_t N>
requires (N > 0)
class Vector;

template<class T, std::size_t ROWS, std::size_t COLUMNS>
Expand Down
Loading

0 comments on commit c7e48fa

Please sign in to comment.