Initial plotting support.

This commit is contained in:
jmsgrogan 2023-01-24 17:15:25 +00:00
parent df450a7be0
commit c2027801be
34 changed files with 756 additions and 20 deletions

View file

@ -6,6 +6,7 @@
#include "CircleNode.h"
#include "LineNode.h"
#include "PathNode.h"
#include "PolygonNode.h"
void addRect(const Point& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes, double radius = 0.0)
{
@ -43,6 +44,17 @@ void addPath(const Point& loc, const std::string& path, std::vector<std::unique_
nodes.push_back(std::move(node));
}
void addPolygon(const Point& loc, std::vector<std::unique_ptr<MaterialNode> >& nodes)
{
auto p0 = Point{ 0.0, 0.0 };
auto p1 = Point{ 150.0, 0.0 };
auto p2 = Point{ 75.0, 75.0 };
auto node = std::make_unique<PolygonNode>(loc);
node->setPoints({ p0, p1, p2 });
nodes.push_back(std::move(node));
}
void addShapes(const Point& start_loc, std::vector<std::unique_ptr<MaterialNode> >& nodes, bool use_fill = false)
{
auto loc = start_loc;
@ -57,6 +69,9 @@ void addShapes(const Point& start_loc, std::vector<std::unique_ptr<MaterialNode>
loc.move(100, 0);
addLine(loc, nodes);
loc.move(200, 0);
addPolygon(loc, nodes);
loc = Point(10, 150);
addRect(loc, nodes, 10.0);