diff options
-rw-r--r-- | dxfdata.cc | 2 | ||||
-rw-r--r-- | dxflinextrude.cc | 6 | ||||
-rw-r--r-- | dxfrotextrude.cc | 2 | ||||
-rw-r--r-- | dxftess.cc | 8 | ||||
-rw-r--r-- | mainwin.cc | 2 | ||||
-rw-r--r-- | openscad.h | 22 | ||||
-rw-r--r-- | primitives.cc | 2 | ||||
-rw-r--r-- | render.cc | 2 | ||||
-rw-r--r-- | surface.cc | 2 |
9 files changed, 24 insertions, 24 deletions
@@ -103,7 +103,7 @@ DxfData::DxfData(double fn, double fs, double fa, QString filename, QString laye int n = get_fragments_from_r(radius, fn, fs, fa); while (start_angle > stop_angle) stop_angle += 360.0; - n = ceil(n * (stop_angle-start_angle) / 360); + n = (int)ceil(n * (stop_angle-start_angle) / 360); for (int i = 0; i < n; i++) { double a1 = ((stop_angle-start_angle)*i)/n; double a2 = ((stop_angle-start_angle)*(i+1))/n; diff --git a/dxflinextrude.cc b/dxflinextrude.cc index ef54aa3..4f2b0c4 100644 --- a/dxflinextrude.cc +++ b/dxflinextrude.cc @@ -78,7 +78,7 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI node->filename = file.text; node->layername = layer.text; node->height = height.num; - node->convexity = convexity.num; + node->convexity = (int)convexity.num; origin.getv2(node->origin_x, node->origin_y); node->scale = scale.num; @@ -97,9 +97,9 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI if (twist.type == Value::NUMBER) { node->twist = twist.num; if (slices.type == Value::NUMBER) { - node->slices = slices.num; + node->slices = (int)slices.num; } else { - node->slices = fmax(2, fabs(get_fragments_from_r(node->height, + node->slices = (int)fmax(2, fabs(get_fragments_from_r(node->height, node->fn, node->fs, node->fa) * node->twist / 360)); } node->has_twist = true; diff --git a/dxfrotextrude.cc b/dxfrotextrude.cc index 7af70f3..e2aca98 100644 --- a/dxfrotextrude.cc +++ b/dxfrotextrude.cc @@ -71,7 +71,7 @@ AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleI node->filename = file.text; node->layername = layer.text; - node->convexity = convexity.num; + node->convexity = (int)convexity.num; origin.getv2(node->origin_x, node->origin_y); node->scale = scale.num; @@ -228,7 +228,7 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, double h) QHash<int, QPair_ii> tri_by_atan2; for (int i = 0; i < tess_tri.count(); i++) for (int j = 0; j < 3; j++) { - int ai = round(atan2(fabs(tess_tri[i].p[(j+1)%3][0] - tess_tri[i].p[j][0]), + int ai = (int)round(atan2(fabs(tess_tri[i].p[(j+1)%3][0] - tess_tri[i].p[j][0]), fabs(tess_tri[i].p[(j+1)%3][1] - tess_tri[i].p[j][1])) / 0.001); tri_by_atan2.insertMulti(ai, QPair<int,int>(i, j)); } @@ -242,7 +242,7 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, double h) for (int k = 0; k < 3; k++) { QHash<QPair_ii, QPair_ii> possible_neigh; - int ai = floor(atan2(fabs(tess_tri[i].p[(k+1)%3][0] - tess_tri[i].p[k][0]), + int ai = (int)floor(atan2(fabs(tess_tri[i].p[(k+1)%3][0] - tess_tri[i].p[k][0]), fabs(tess_tri[i].p[(k+1)%3][1] - tess_tri[i].p[k][1])) / 0.001 - 0.5); for (int j = 0; j < 2; j++) { foreach (QPair_ii jl, tri_by_atan2.values(ai+j)) @@ -266,13 +266,13 @@ void dxf_tesselate(PolySet *ps, DxfData *dxf, double rot, bool up, double h) tess_tri.append(tess_triangle(tess_tri[j].p[l], tess_tri[i].p[(k+1)%3], tess_tri[i].p[(k+2)%3])); for (int m = 0; m < 2; m++) { - int ai = round(atan2(fabs(tess_tri.last().p[(m+1)%3][0] - tess_tri.last().p[m][0]), + int ai = (int)round(atan2(fabs(tess_tri.last().p[(m+1)%3][0] - tess_tri.last().p[m][0]), fabs(tess_tri.last().p[(m+1)%3][1] - tess_tri.last().p[m][1])) / 0.001 ); tri_by_atan2.insertMulti(ai, QPair<int,int>(tess_tri.count()-1, m)); } tess_tri[i].p[(k+1)%3] = tess_tri[j].p[l]; for (int m = 0; m < 2; m++) { - int ai = round(atan2(fabs(tess_tri[i].p[(m+1)%3][0] - tess_tri[i].p[m][0]), + int ai = (int)round(atan2(fabs(tess_tri[i].p[(m+1)%3][0] - tess_tri[i].p[m][0]), fabs(tess_tri[i].p[(m+1)%3][1] - tess_tri[i].p[m][1])) / 0.001 ); tri_by_atan2.insertMulti(ai, QPair<int,int>(i, m)); } @@ -228,7 +228,7 @@ void MainWindow::updatedFps() if (!fps_ok || fps <= 0) { animate_timer->stop(); } else { - animate_timer->setInterval(1000 / e_fps->text().toDouble()); + animate_timer->setInterval(int(1000 / e_fps->text().toDouble())); animate_timer->start(); } } @@ -81,8 +81,8 @@ public: res = resolution; } T &align(double &x, double &y) { - int ix = round(x / res); - int iy = round(y / res); + int ix = (int)round(x / res); + int iy = (int)round(y / res); x = ix * res, y = iy * res; if (db.contains(QPair<int,int>(ix, iy))) return db[QPair<int,int>(ix, iy)]; @@ -103,14 +103,14 @@ public: return db[QPair<int,int>(ix, iy)]; } bool has(double x, double y) { - int ix = round(x / res); - int iy = round(y / res); + int ix = (int)round(x / res); + int iy = (int)round(y / res); if (db.contains(QPair<int,int>(ix, iy))) return true; for (int jx = ix - 1; jx <= ix + 1; jx++) for (int jy = iy - 1; jy <= iy + 1; jy++) { if (db.contains(QPair<int,int>(jx, jy))) - true; + return true; } return false; } @@ -137,9 +137,9 @@ public: res = resolution; } T &align(double &x, double &y, double &z) { - int ix = round(x / res); - int iy = round(y / res); - int iz = round(z / res); + int ix = (int)round(x / res); + int iy = (int)round(y / res); + int iz = (int)round(z / res); x = ix * res, y = iy * res, z = iz * res; if (db.contains(QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz))) return db[QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz)]; @@ -162,9 +162,9 @@ public: } bool has(double x, double y, double z) { - int ix = round(x / res); - int iy = round(y / res); - int iz = round(z / res); + int ix = (int)round(x / res); + int iy = (int)round(y / res); + int iz = (int)round(z / res); if (db.contains(QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz))) return true; for (int jx = ix - 1; jx <= ix + 1; jx++) diff --git a/primitives.cc b/primitives.cc index c08e0a1..f93755c 100644 --- a/primitives.cc +++ b/primitives.cc @@ -133,7 +133,7 @@ void register_builtin_primitives() int get_fragments_from_r(double r, double fn, double fs, double fa) { if (fn > 0.0) - return fn; + return (int)fn; return (int)ceil(fmax(fmin(360.0 / fa, r*M_PI / fs), 5)); } @@ -56,7 +56,7 @@ AbstractNode *RenderModule::evaluate(const Context *ctx, const ModuleInstanciati Value v = c.lookup_variable("convexity"); if (v.type == Value::NUMBER) - node->convexity = v.num; + node->convexity = (int)v.num; foreach (ModuleInstanciation *v, inst->children) { AbstractNode *n = v->evaluate(inst->ctx); @@ -63,7 +63,7 @@ AbstractNode *SurfaceModule::evaluate(const Context *ctx, const ModuleInstanciat Value convexity = c.lookup_variable("convexity", true); if (convexity.type == Value::NUMBER) { - node->convexity = convexity.num; + node->convexity = (int)convexity.num; } return node; |