mirror of https://github.com/vitalif/openscad
bugfix: #562 didn't take into account that it's allowed with all X coordinates being negative
parent
a3aa61bab2
commit
cca80a1559
|
@ -455,19 +455,21 @@ PolySet *PolySetCGALEvaluator::rotateDxfData(const RotateExtrudeNode &node, DxfD
|
||||||
|
|
||||||
for (size_t i = 0; i < dxf.paths.size(); i++)
|
for (size_t i = 0; i < dxf.paths.size(); i++)
|
||||||
{
|
{
|
||||||
|
double min_x = 0;
|
||||||
double max_x = 0;
|
double max_x = 0;
|
||||||
for (size_t j = 0; j < dxf.paths[i].indices.size(); j++) {
|
for (size_t j = 0; j < dxf.paths[i].indices.size(); j++) {
|
||||||
double point_x = dxf.points[dxf.paths[i].indices[j]][0];
|
double point_x = dxf.points[dxf.paths[i].indices[j]][0];
|
||||||
if (point_x < 0) {
|
min_x = fmin(min_x, point_x);
|
||||||
PRINT("ERROR: all points for rotate_extrude() must have non-negative X coordinates");
|
max_x = fmax(max_x, point_x);
|
||||||
PRINTB("[Point %d on path %d has X coordinate %f]", j % i % 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;
|
delete ps;
|
||||||
return NULL;
|
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;
|
double ***points;
|
||||||
points = new double**[fragments];
|
points = new double**[fragments];
|
||||||
|
|
|
@ -32,3 +32,6 @@ translate([50,50,0]) {
|
||||||
// Minimal $fn
|
// Minimal $fn
|
||||||
translate([0,-60,0]) rotate_extrude($fn=1) translate([20,0,0]) circle(r=10,$fn=1);
|
translate([0,-60,0]) rotate_extrude($fn=1) translate([20,0,0]) circle(r=10,$fn=1);
|
||||||
|
|
||||||
|
// Object in negative X
|
||||||
|
translate([0,60,0]) rotate_extrude() translate([-20,0]) square(10);
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 18 KiB |
|
@ -50,4 +50,11 @@ group() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
multmatrix([[1, 0, 0, 0], [0, 1, 0, 60], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
|
rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 2) {
|
||||||
|
multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
|
square(size = [10, 10], center = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 7.9 KiB |
Loading…
Reference in New Issue