-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e2dee4
commit d898a74
Showing
10 changed files
with
214 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ RUN apt-get update \ | |
gdb \ | ||
git \ | ||
cmake \ | ||
clang-tidy | ||
clang-tidy \ | ||
gnuplot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
* | ||
|
||
!.gitignore | ||
|
||
!CMakeLists.txt | ||
!CMakeLists.txt.in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include(FetchContent) | ||
|
||
FetchContent_Declare(matplotplusplus | ||
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus | ||
GIT_TAG origin/master) # or whatever tag you want | ||
|
||
FetchContent_GetProperties(matplotplusplus) | ||
if(NOT matplotplusplus_POPULATED) | ||
FetchContent_Populate(matplotplusplus) | ||
add_subdirectory(${matplotplusplus_SOURCE_DIR} ${matplotplusplus_BINARY_DIR} EXCLUDE_FROM_ALL) | ||
endif() | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
PRIVATE | ||
matplot | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#ifndef PATHING_PLOTTING_HPP | ||
#define PATHING_PLOTTING_HPP | ||
|
||
#include <list> | ||
|
||
#include <matplot/matplot.h> | ||
#include "utilities/datatypes.hpp" | ||
|
||
class PathingPlot { | ||
public: | ||
void addPoints(std::vector<XYZCoord> pts); | ||
void addPolygons(std::vector<Polygon> polygons); | ||
void addPolylines(std::vector<Polyline> polylines); | ||
|
||
// Used to group changes to the plot into logical chunks | ||
virtual void beginUpdate() = 0; // Call before making changes to the plot | ||
virtual void endUpdate() = 0; // Call when done making changes to the plot | ||
|
||
virtual void addPolygon(Polygon polygon) = 0; | ||
virtual void addPolyline(Polyline polyline) = 0; | ||
virtual void addPoint(XYZCoord pt) = 0; | ||
|
||
// Output to filename. Don't include extension as the subclass | ||
// will add the correct extension itself | ||
virtual void output(std::string filename) = 0; | ||
}; | ||
|
||
// Saves a record of all of the updates that have been done | ||
// When plotted, creates a GIF | ||
class AnimationPathingPlot : public PathingPlot { | ||
public: | ||
AnimationPathingPlot(); | ||
|
||
void beginUpdate() override; | ||
void endUpdate() override; | ||
|
||
void addPolygon(Polygon polygon) override; | ||
void addPolyline(Polyline polyline) override; | ||
void addPoint(XYZCoord pt) override; | ||
|
||
void output(std::string filename) override; | ||
private: | ||
std::list<std::list<XYZCoord>> coords; | ||
std::list<std::list<Polygon>> polygons; | ||
std::list<std::list<Polyline>> polylines; | ||
}; | ||
|
||
// Only records the most recent state of the plot | ||
// When plotted, creates a PNG | ||
class StaticPathingPlot : public PathingPlot { | ||
public: | ||
StaticPathingPlot(); | ||
|
||
void beginUpdate() override; | ||
void endUpdate() override; | ||
|
||
void addPolygon(Polygon polygon) override; | ||
void addPolyline(Polyline polyline) override; | ||
void addPoint(XYZCoord pt) override; | ||
|
||
void output(std::string filename) override; | ||
private: | ||
std::list<XYZCoord> coords; | ||
std::list<Polygon> polygons; | ||
std::list<Polyline> polylines; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include "pathing/plotting.hpp" | ||
#include "utilities/datatypes.hpp" | ||
|
||
#include <vector> | ||
|
||
void PathingPlot::addPoints(std::vector<XYZCoord> pts) { | ||
for (auto pt : pts) { | ||
this->addPoint(pt); | ||
} | ||
} | ||
|
||
void PathingPlot::addPolygons(std::vector<Polygon> polygons) { | ||
for (auto polygon : polygons) { | ||
this->addPolygon(polygon); | ||
} | ||
} | ||
|
||
void PathingPlot::addPolylines(std::vector<Polyline> polylines) { | ||
for (auto polyline : polylines) { | ||
this->addPolyline(polyline); | ||
} | ||
} | ||
|
||
|
||
AnimationPathingPlot::AnimationPathingPlot() { | ||
// TODO: init member vars | ||
} | ||
|
||
void AnimationPathingPlot::beginUpdate() { | ||
// TODO: delineate update | ||
} | ||
|
||
void AnimationPathingPlot::endUpdate() { | ||
// TODO: delinate end of update | ||
} | ||
|
||
void AnimationPathingPlot::addPoint(XYZCoord pt) { | ||
// TODO: add point | ||
} | ||
|
||
void AnimationPathingPlot::addPolygon(Polygon polygon) { | ||
// TODO: add polygon | ||
} | ||
|
||
void AnimationPathingPlot::addPolyline(Polyline polyline) { | ||
// TODO: add polyline | ||
} | ||
|
||
void AnimationPathingPlot::output(std::string filename) { | ||
// TODO: go through all the data and create GIF | ||
// append .gif to filename param | ||
} | ||
|
||
|
||
StaticPathingPlot::StaticPathingPlot() { | ||
// TODO: init member vars | ||
} | ||
|
||
void StaticPathingPlot::beginUpdate() { | ||
// does nothing | ||
} | ||
|
||
void StaticPathingPlot::endUpdate() { | ||
// does nothing | ||
} | ||
|
||
void StaticPathingPlot::addPoint(XYZCoord pt) { | ||
// TODO: add point | ||
} | ||
|
||
void StaticPathingPlot::addPolygon(Polygon polygon) { | ||
// TODO: add polygon | ||
} | ||
|
||
void StaticPathingPlot::addPolyline(Polyline polyline) { | ||
// TODO: add polyline | ||
} | ||
|
||
void StaticPathingPlot::output(std::string filename) { | ||
// TODO: go through all the data and create image | ||
// append .png to filename param | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "utilities/datatypes.hpp" | ||
|
||
Polygon::Polygon(matplot::color color) { | ||
this->color = color; | ||
} | ||
|
||
Polyline::Polyline(matplot::color color) { | ||
this->color = color; | ||
} |