mirror of https://github.com/vitalif/openscad
Clifford Wolf:
Fixed some trivial compiler warnings git-svn-id: http://svn.clifford.at/openscad/trunk@87 b57f626f-c46c-0410-a088-ec61d464b74cstl_dim
parent
cf190ff46e
commit
8f2653820e
|
@ -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);
|
int n = get_fragments_from_r(radius, fn, fs, fa);
|
||||||
while (start_angle > stop_angle)
|
while (start_angle > stop_angle)
|
||||||
stop_angle += 360.0;
|
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++) {
|
for (int i = 0; i < n; i++) {
|
||||||
double a1 = ((stop_angle-start_angle)*i)/n;
|
double a1 = ((stop_angle-start_angle)*i)/n;
|
||||||
double a2 = ((stop_angle-start_angle)*(i+1))/n;
|
double a2 = ((stop_angle-start_angle)*(i+1))/n;
|
||||||
|
|
|
@ -78,7 +78,7 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI
|
||||||
node->filename = file.text;
|
node->filename = file.text;
|
||||||
node->layername = layer.text;
|
node->layername = layer.text;
|
||||||
node->height = height.num;
|
node->height = height.num;
|
||||||
node->convexity = convexity.num;
|
node->convexity = (int)convexity.num;
|
||||||
origin.getv2(node->origin_x, node->origin_y);
|
origin.getv2(node->origin_x, node->origin_y);
|
||||||
node->scale = scale.num;
|
node->scale = scale.num;
|
||||||
|
|
||||||
|
@ -97,9 +97,9 @@ AbstractNode *DxfLinearExtrudeModule::evaluate(const Context *ctx, const ModuleI
|
||||||
if (twist.type == Value::NUMBER) {
|
if (twist.type == Value::NUMBER) {
|
||||||
node->twist = twist.num;
|
node->twist = twist.num;
|
||||||
if (slices.type == Value::NUMBER) {
|
if (slices.type == Value::NUMBER) {
|
||||||
node->slices = slices.num;
|
node->slices = (int)slices.num;
|
||||||
} else {
|
} 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->fn, node->fs, node->fa) * node->twist / 360));
|
||||||
}
|
}
|
||||||
node->has_twist = true;
|
node->has_twist = true;
|
||||||
|
|
|
@ -71,7 +71,7 @@ AbstractNode *DxfRotateExtrudeModule::evaluate(const Context *ctx, const ModuleI
|
||||||
|
|
||||||
node->filename = file.text;
|
node->filename = file.text;
|
||||||
node->layername = layer.text;
|
node->layername = layer.text;
|
||||||
node->convexity = convexity.num;
|
node->convexity = (int)convexity.num;
|
||||||
origin.getv2(node->origin_x, node->origin_y);
|
origin.getv2(node->origin_x, node->origin_y);
|
||||||
node->scale = scale.num;
|
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;
|
QHash<int, QPair_ii> tri_by_atan2;
|
||||||
for (int i = 0; i < tess_tri.count(); i++)
|
for (int i = 0; i < tess_tri.count(); i++)
|
||||||
for (int j = 0; j < 3; j++) {
|
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);
|
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));
|
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++)
|
for (int k = 0; k < 3; k++)
|
||||||
{
|
{
|
||||||
QHash<QPair_ii, QPair_ii> possible_neigh;
|
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);
|
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++) {
|
for (int j = 0; j < 2; j++) {
|
||||||
foreach (QPair_ii jl, tri_by_atan2.values(ai+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.append(tess_triangle(tess_tri[j].p[l],
|
||||||
tess_tri[i].p[(k+1)%3], tess_tri[i].p[(k+2)%3]));
|
tess_tri[i].p[(k+1)%3], tess_tri[i].p[(k+2)%3]));
|
||||||
for (int m = 0; m < 2; m++) {
|
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 );
|
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));
|
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];
|
tess_tri[i].p[(k+1)%3] = tess_tri[j].p[l];
|
||||||
for (int m = 0; m < 2; m++) {
|
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 );
|
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));
|
tri_by_atan2.insertMulti(ai, QPair<int,int>(i, m));
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ void MainWindow::updatedFps()
|
||||||
if (!fps_ok || fps <= 0) {
|
if (!fps_ok || fps <= 0) {
|
||||||
animate_timer->stop();
|
animate_timer->stop();
|
||||||
} else {
|
} else {
|
||||||
animate_timer->setInterval(1000 / e_fps->text().toDouble());
|
animate_timer->setInterval(int(1000 / e_fps->text().toDouble()));
|
||||||
animate_timer->start();
|
animate_timer->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
22
openscad.h
22
openscad.h
|
@ -81,8 +81,8 @@ public:
|
||||||
res = resolution;
|
res = resolution;
|
||||||
}
|
}
|
||||||
T &align(double &x, double &y) {
|
T &align(double &x, double &y) {
|
||||||
int ix = round(x / res);
|
int ix = (int)round(x / res);
|
||||||
int iy = round(y / res);
|
int iy = (int)round(y / res);
|
||||||
x = ix * res, y = iy * res;
|
x = ix * res, y = iy * res;
|
||||||
if (db.contains(QPair<int,int>(ix, iy)))
|
if (db.contains(QPair<int,int>(ix, iy)))
|
||||||
return db[QPair<int,int>(ix, iy)];
|
return db[QPair<int,int>(ix, iy)];
|
||||||
|
@ -103,14 +103,14 @@ public:
|
||||||
return db[QPair<int,int>(ix, iy)];
|
return db[QPair<int,int>(ix, iy)];
|
||||||
}
|
}
|
||||||
bool has(double x, double y) {
|
bool has(double x, double y) {
|
||||||
int ix = round(x / res);
|
int ix = (int)round(x / res);
|
||||||
int iy = round(y / res);
|
int iy = (int)round(y / res);
|
||||||
if (db.contains(QPair<int,int>(ix, iy)))
|
if (db.contains(QPair<int,int>(ix, iy)))
|
||||||
return true;
|
return true;
|
||||||
for (int jx = ix - 1; jx <= ix + 1; jx++)
|
for (int jx = ix - 1; jx <= ix + 1; jx++)
|
||||||
for (int jy = iy - 1; jy <= iy + 1; jy++) {
|
for (int jy = iy - 1; jy <= iy + 1; jy++) {
|
||||||
if (db.contains(QPair<int,int>(jx, jy)))
|
if (db.contains(QPair<int,int>(jx, jy)))
|
||||||
true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -137,9 +137,9 @@ public:
|
||||||
res = resolution;
|
res = resolution;
|
||||||
}
|
}
|
||||||
T &align(double &x, double &y, double &z) {
|
T &align(double &x, double &y, double &z) {
|
||||||
int ix = round(x / res);
|
int ix = (int)round(x / res);
|
||||||
int iy = round(y / res);
|
int iy = (int)round(y / res);
|
||||||
int iz = round(z / res);
|
int iz = (int)round(z / res);
|
||||||
x = ix * res, y = iy * res, z = iz * res;
|
x = ix * res, y = iy * res, z = iz * res;
|
||||||
if (db.contains(QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz)))
|
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)];
|
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) {
|
bool has(double x, double y, double z) {
|
||||||
int ix = round(x / res);
|
int ix = (int)round(x / res);
|
||||||
int iy = round(y / res);
|
int iy = (int)round(y / res);
|
||||||
int iz = round(z / res);
|
int iz = (int)round(z / res);
|
||||||
if (db.contains(QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz)))
|
if (db.contains(QPair<QPair<int,int>,int>(QPair<int,int>(ix, iy), iz)))
|
||||||
return true;
|
return true;
|
||||||
for (int jx = ix - 1; jx <= ix + 1; jx++)
|
for (int jx = ix - 1; jx <= ix + 1; jx++)
|
||||||
|
|
|
@ -133,7 +133,7 @@ void register_builtin_primitives()
|
||||||
int get_fragments_from_r(double r, double fn, double fs, double fa)
|
int get_fragments_from_r(double r, double fn, double fs, double fa)
|
||||||
{
|
{
|
||||||
if (fn > 0.0)
|
if (fn > 0.0)
|
||||||
return fn;
|
return (int)fn;
|
||||||
return (int)ceil(fmax(fmin(360.0 / fa, r*M_PI / fs), 5));
|
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");
|
Value v = c.lookup_variable("convexity");
|
||||||
if (v.type == Value::NUMBER)
|
if (v.type == Value::NUMBER)
|
||||||
node->convexity = v.num;
|
node->convexity = (int)v.num;
|
||||||
|
|
||||||
foreach (ModuleInstanciation *v, inst->children) {
|
foreach (ModuleInstanciation *v, inst->children) {
|
||||||
AbstractNode *n = v->evaluate(inst->ctx);
|
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);
|
Value convexity = c.lookup_variable("convexity", true);
|
||||||
if (convexity.type == Value::NUMBER) {
|
if (convexity.type == Value::NUMBER) {
|
||||||
node->convexity = convexity.num;
|
node->convexity = (int)convexity.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
|
|
Loading…
Reference in New Issue