Loading include/csg_types.hpp +2 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ #include <array> #include <memory> #include <optional> #include <stdexcept> #include <tuple> #include <variant> #include <vector> Loading Loading @@ -62,9 +61,7 @@ public: Polyhedron(const std::vector<std::vector<double>> &points, const std::vector<std::vector<double>> &faces) { for (const auto &pt : points) { if (pt.size() != 3) throw std::runtime_error("Error parsing polyhedron. Check input!"); assert(pt.size() == 3); m_points.push_back({pt[0], pt[1], pt[2]}); } for (const auto &f : faces) { Loading @@ -89,9 +86,7 @@ public: Polygon(const std::vector<std::vector<double>> &points, const std::vector<double> &path) { for (const auto &pt : points) { if (pt.size() != 2) throw std::runtime_error("Error parsing polygon. Check input!"); assert(pt.size() == 2); m_points.push_back({pt[0], pt[1]}); } for (const auto &p : path) { Loading src/csg/exception.cpp +1 −1 Original line number Diff line number Diff line #include <csg_exception.hpp> #include "csg_exception.hpp" #include <sstream> #include <string> Loading src/csg/parser.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include <tao/pegtl.hpp> // includes #include "csg_exception.hpp" #include "csg_types.hpp" using namespace tao::pegtl; Loading Loading @@ -509,7 +510,8 @@ template <> struct action<cylinder> { if (curr_attr.count("r")) { // proper cylinder if (curr_attr.count("r1") || curr_attr.count("r2")) { throw std::runtime_error( throw csg::Exception( "action<cylinder>", " ERROR: cannot specify both r and (r1 or r2); ambiguous "); } csg::Cylinder cyl; Loading Loading @@ -591,8 +593,8 @@ template <> struct action<polygon> { if (std::holds_alternative<std::string>(curr_attr["paths"])) { auto paths_str = std::get<std::string>(curr_attr["paths"]); if (paths_str != UNDEFINED_STR) throw std::runtime_error("Error parsing polygon. paths = " + paths_str + " not recognized"); throw csg::Exception("action<polygon>", "paths = " + paths_str + " not recognized"); } else { paths = std::get<std::vector<std::vector<double>>>(curr_attr["paths"]); } Loading Loading @@ -737,8 +739,8 @@ std::shared_ptr<Tree> parse_csg(std::string str) { } if (tree.top.objs.empty()) throw std::runtime_error( "Error parsing. Empty csg file"); // Disallow empty .csg file throw csg::Exception("parse_csg", "Empty csg file"); // Disallow empty .csg file return std::make_shared<Tree>(tree); } Loading Loading
include/csg_types.hpp +2 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ #include <array> #include <memory> #include <optional> #include <stdexcept> #include <tuple> #include <variant> #include <vector> Loading Loading @@ -62,9 +61,7 @@ public: Polyhedron(const std::vector<std::vector<double>> &points, const std::vector<std::vector<double>> &faces) { for (const auto &pt : points) { if (pt.size() != 3) throw std::runtime_error("Error parsing polyhedron. Check input!"); assert(pt.size() == 3); m_points.push_back({pt[0], pt[1], pt[2]}); } for (const auto &f : faces) { Loading @@ -89,9 +86,7 @@ public: Polygon(const std::vector<std::vector<double>> &points, const std::vector<double> &path) { for (const auto &pt : points) { if (pt.size() != 2) throw std::runtime_error("Error parsing polygon. Check input!"); assert(pt.size() == 2); m_points.push_back({pt[0], pt[1]}); } for (const auto &p : path) { Loading
src/csg/exception.cpp +1 −1 Original line number Diff line number Diff line #include <csg_exception.hpp> #include "csg_exception.hpp" #include <sstream> #include <string> Loading
src/csg/parser.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ #include <tao/pegtl.hpp> // includes #include "csg_exception.hpp" #include "csg_types.hpp" using namespace tao::pegtl; Loading Loading @@ -509,7 +510,8 @@ template <> struct action<cylinder> { if (curr_attr.count("r")) { // proper cylinder if (curr_attr.count("r1") || curr_attr.count("r2")) { throw std::runtime_error( throw csg::Exception( "action<cylinder>", " ERROR: cannot specify both r and (r1 or r2); ambiguous "); } csg::Cylinder cyl; Loading Loading @@ -591,8 +593,8 @@ template <> struct action<polygon> { if (std::holds_alternative<std::string>(curr_attr["paths"])) { auto paths_str = std::get<std::string>(curr_attr["paths"]); if (paths_str != UNDEFINED_STR) throw std::runtime_error("Error parsing polygon. paths = " + paths_str + " not recognized"); throw csg::Exception("action<polygon>", "paths = " + paths_str + " not recognized"); } else { paths = std::get<std::vector<std::vector<double>>>(curr_attr["paths"]); } Loading Loading @@ -737,8 +739,8 @@ std::shared_ptr<Tree> parse_csg(std::string str) { } if (tree.top.objs.empty()) throw std::runtime_error( "Error parsing. Empty csg file"); // Disallow empty .csg file throw csg::Exception("parse_csg", "Empty csg file"); // Disallow empty .csg file return std::make_shared<Tree>(tree); } Loading