diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 5 | ||||
-rw-r--r-- | src/Preferences.cc | 18 | ||||
-rw-r--r-- | src/func.cc | 18 | ||||
-rw-r--r-- | src/value.cc | 1 |
4 files changed, 23 insertions, 19 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index a54fe02..88d1f00 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -85,6 +85,11 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad std::string opstr = op == CGE_UNION ? "union" : op == CGE_INTERSECTION ? "intersection" : op == CGE_DIFFERENCE ? "difference" : op == CGE_MINKOWSKI ? "minkowski" : "UNKNOWN"; PRINTF("CGAL error in CGAL_Nef_polyhedron's %s operator: %s", opstr.c_str(), e.what()); + + // Minkowski errors can result in corrupt polyhedrons + if (op == CGE_MINKOWSKI) { + target = src; + } } CGAL::set_error_behaviour(old_behaviour); } diff --git a/src/Preferences.cc b/src/Preferences.cc index 4c43f2d..e05106b 100644 --- a/src/Preferences.cc +++ b/src/Preferences.cc @@ -47,16 +47,24 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent) // Setup default settings this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text(); + this->defaultmap["advanced/opencsg_show_warning"] = true; + this->defaultmap["advanced/enable_opencsg_opengl1x"] = true; + + // Setup default font (Try to use a nice monospace font) + QString fontfamily; #ifdef Q_WS_X11 - this->defaultmap["editor/fontfamily"] = "Mono"; + fontfamily = "Mono"; #elif defined (Q_WS_WIN) - this->defaultmap["editor/fontfamily"] = "Console"; + fontfamily = "Console"; #elif defined (Q_WS_MAC) - this->defaultmap["editor/fontfamily"] = "Monaco"; + fontfamily = "Monaco"; #endif + QFont font; + font.setStyleHint(QFont::TypeWriter); + font.setFamily(fontfamily); // this runs Qt's font matching algorithm + QString found_family(QFontInfo(font).family()); + this->defaultmap["editor/fontfamily"] = found_family; this->defaultmap["editor/fontsize"] = 12; - this->defaultmap["advanced/opencsg_show_warning"] = true; - this->defaultmap["advanced/enable_opencsg_opengl1x"] = true; // Toolbar QActionGroup *group = new QActionGroup(this); diff --git a/src/func.cc b/src/func.cc index 1138173..6686cb9 100644 --- a/src/func.cc +++ b/src/func.cc @@ -96,24 +96,14 @@ std::string BuiltinFunction::dump(const std::string &indent, const std::string & return dump.str(); } -static double deg2rad(double x) +static inline double deg2rad(double x) { - while (x < 0.0) - x += 360.0; - while (x >= 360.0) - x -= 360.0; - x = x * M_PI * 2.0 / 360.0; - return x; + return x * M_PI / 180.0; } -static double rad2deg(double x) +static inline double rad2deg(double x) { - x = x * 360.0 / (M_PI * 2.0); - while (x < 0.0) - x += 360.0; - while (x >= 360.0) - x -= 360.0; - return x; + return x * 180.0 / M_PI; } Value builtin_abs(const Context *, const std::vector<std::string>&, const std::vector<Value> &args) diff --git a/src/value.cc b/src/value.cc index 2cc6244..c9440ae 100644 --- a/src/value.cc +++ b/src/value.cc @@ -369,6 +369,7 @@ std::string Value::toString() const { std::stringstream tmp; tmp.precision(16); + tmp.setf(std::ios_base::fixed); tmp << this->num; std::string tmpstr = tmp.str(); if (tmpstr.size() > 16) tmpstr.erase(16); |