mirror of https://github.com/vitalif/openscad
commit
6a0d70033d
|
@ -413,7 +413,7 @@ Response GeometryEvaluator::visit(State &state, const OffsetNode &node)
|
||||||
// ClipperLib documentation: The formula for the number of steps in a full
|
// ClipperLib documentation: The formula for the number of steps in a full
|
||||||
// circular arc is ... Pi / acos(1 - arc_tolerance / abs(delta))
|
// circular arc is ... Pi / acos(1 - arc_tolerance / abs(delta))
|
||||||
double n = Calc::get_fragments_from_r(10, node.fn, node.fs, node.fa);
|
double n = Calc::get_fragments_from_r(10, node.fn, node.fs, node.fa);
|
||||||
double arc_tolerance = abs(node.delta) * (1 - cos(M_PI / n));
|
double arc_tolerance = std::abs(node.delta) * (1 - cos(M_PI / n));
|
||||||
const Polygon2d *result = ClipperUtils::applyOffset(*polygon, node.delta, node.join_type, node.miter_limit, arc_tolerance);
|
const Polygon2d *result = ClipperUtils::applyOffset(*polygon, node.delta, node.join_type, node.miter_limit, arc_tolerance);
|
||||||
assert(result);
|
assert(result);
|
||||||
geom.reset(result);
|
geom.reset(result);
|
||||||
|
|
|
@ -34,6 +34,10 @@ offset(-4) shape1(-1, 0);
|
||||||
shape1(0, 0);
|
shape1(0, 0);
|
||||||
offset(4) shape1(1, 0);
|
offset(4) shape1(1, 0);
|
||||||
|
|
||||||
offset(delta = -5) shape1(-1, -1);
|
offset(delta = -5) shape1(2, 1);
|
||||||
shape1(0, -1);
|
shape1(0, -1);
|
||||||
offset(delta = 5) shape1(1, -1);
|
offset(delta = 5) shape1(1, -1);
|
||||||
|
|
||||||
|
// Bug with fragment calculateion with delta < 1 due to abs() instead of std::abs()
|
||||||
|
translate([-50,-50]) scale([25,25,1])
|
||||||
|
offset(delta = 0.9, join_type="round") square(.1);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 10 KiB |
|
@ -104,7 +104,7 @@ group() {
|
||||||
}
|
}
|
||||||
offset(delta = -5, join_type = miter, miter_limit = 2, $fn = 0, $fa = 12, $fs = 2) {
|
offset(delta = -5, join_type = miter, miter_limit = 2, $fn = 0, $fa = 12, $fs = 2) {
|
||||||
group() {
|
group() {
|
||||||
multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
multmatrix([[1, 0, 0, 100], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
difference() {
|
difference() {
|
||||||
square(size = [30, 30], center = true);
|
square(size = [30, 30], center = true);
|
||||||
square(size = [8, 8], center = true);
|
square(size = [8, 8], center = true);
|
||||||
|
@ -130,4 +130,11 @@ group() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
|
multmatrix([[25, 0, 0, 0], [0, 25, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
|
||||||
|
offset(delta = 0.9, join_type = round, miter_limit = 2, $fn = 0, $fa = 12, $fs = 2) {
|
||||||
|
square(size = [0.1, 0.1], center = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue