diff options
author | Marius Kintel <marius@kintel.net> | 2013-12-14 22:44:05 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-12-14 22:44:05 (GMT) |
commit | cca80a15590c24de9bfd4654b19a64bf1426cf54 (patch) | |
tree | 04de01e802cbac57148d5baa7ee2e302f2babc0e /src | |
parent | a3aa61bab2c88fce649a9515dec0ddb7d15be085 (diff) |
bugfix: #562 didn't take into account that it's allowed with all X coordinates being negative
Diffstat (limited to 'src')
-rw-r--r-- | src/PolySetCGALEvaluator.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 599fd7f..a2d896d 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -455,19 +455,21 @@ PolySet *PolySetCGALEvaluator::rotateDxfData(const RotateExtrudeNode &node, DxfD for (size_t i = 0; i < dxf.paths.size(); i++) { + double min_x = 0; double max_x = 0; for (size_t j = 0; j < dxf.paths[i].indices.size(); j++) { double point_x = dxf.points[dxf.paths[i].indices[j]][0]; - if (point_x < 0) { - PRINT("ERROR: all points for rotate_extrude() must have non-negative X coordinates"); - PRINTB("[Point %d on path %d has X coordinate %f]", j % i % point_x); + min_x = fmin(min_x, point_x); + max_x = fmax(max_x, point_x); + + if ((max_x - min_x) > max_x && (max_x - min_x) > fabs(min_x)) { + PRINTB("ERROR: all points for rotate_extrude() must have the same X coordinate sign (range is %.2f -> %.2f)", min_x % max_x); delete ps; return NULL; } - max_x = fmax(max_x, point_x); } - int fragments = get_fragments_from_r(max_x, node.fn, node.fs, node.fa); + int fragments = get_fragments_from_r(max_x-min_x, node.fn, node.fs, node.fa); double ***points; points = new double**[fragments]; |