Initial circuits plugin work.

This commit is contained in:
jmsgrogan 2023-01-20 16:47:39 +00:00
parent b5f21900eb
commit f8a2ce3c59
50 changed files with 1451 additions and 97 deletions

View file

@ -0,0 +1,66 @@
#include "PointParser.h"
#include <sstream>
std::string PointParser::toString(const Point& p, std::size_t dimensions, const std::string& delimiter, std::size_t precision)
{
return toString(p.getX(), p.getY(), p.getZ(), dimensions, delimiter, precision);
}
std::string PointParser::toStringRelative(const Point& p, const Point& relativeTo, std::size_t dimensions, const std::string& delimiter, std::size_t precision)
{
return toString(relativeTo.getDeltaX(p), relativeTo.getDeltaY(p), relativeTo.getDeltaZ(p), dimensions, delimiter, precision);
}
std::string PointParser::toString(double x, double y, double z, std::size_t dimensions, const std::string& delimiter, std::size_t precision)
{
if (precision == 0)
{
if (dimensions == 1)
{
return std::to_string(x);
}
else if (dimensions == 2)
{
return std::to_string(x) + delimiter + std::to_string(y);
}
else
{
return std::to_string(x) + delimiter + std::to_string(y) + delimiter + std::to_string(z);
}
}
else
{
std::stringstream sstr;
sstr.precision(precision);
if (dimensions == 1)
{
sstr << x;
}
else if (dimensions == 2)
{
sstr << x << delimiter << y;
}
else
{
sstr << x << delimiter << y << delimiter << z;
}
return sstr.str();
}
}
std::string PointParser::toString(double x, std::size_t precision)
{
if (precision == 0)
{
return std::to_string(x);
}
else
{
std::stringstream sstr;
sstr.precision(precision);
sstr << x;
return sstr.str();
}
}