mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-02-19 10:09:39 +00:00
further fixes to path_extrude2d
This commit is contained in:
parent
5934705dcd
commit
662f6c458d
1 changed files with 9 additions and 15 deletions
|
@ -478,7 +478,7 @@ module chain_hull()
|
||||||
// path_extrude2d(path, [caps], [closed]) {...}
|
// path_extrude2d(path, [caps], [closed]) {...}
|
||||||
// Description:
|
// Description:
|
||||||
// Extrudes 2D children along the given 2D path, with optional rounded endcaps. This module works properly in general only if the given
|
// Extrudes 2D children along the given 2D path, with optional rounded endcaps. This module works properly in general only if the given
|
||||||
// children are symmetric across the Y axis. It works by constructing flat sections corresponding to each segment of the path and
|
// children are convex and symmetric across the Y axis. It works by constructing flat sections corresponding to each segment of the path and
|
||||||
// inserting rounded joints at each corner.
|
// inserting rounded joints at each corner.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// path = The 2D path to extrude the geometry along.
|
// path = The 2D path to extrude the geometry along.
|
||||||
|
@ -510,23 +510,17 @@ module path_extrude2d(path, caps=false, closed=false) {
|
||||||
for (p=pair(path,wrap=closed))
|
for (p=pair(path,wrap=closed))
|
||||||
extrude_from_to(p[0],p[1]) xflip()rot(-90)children();
|
extrude_from_to(p[0],p[1]) xflip()rot(-90)children();
|
||||||
for (t=triplet(path,wrap=closed)) {
|
for (t=triplet(path,wrap=closed)) {
|
||||||
ang = 180-vector_angle(t);
|
ang = -(180-vector_angle(t)) * sign(_point_left_of_line2d(t[2],[t[0],t[1]]));
|
||||||
rightside = _point_left_of_line2d(t[2],[t[0],t[1]])>0;
|
|
||||||
delt = point3d(t[2] - t[1]);
|
delt = point3d(t[2] - t[1]);
|
||||||
if (ang>0)
|
if (ang!=0)
|
||||||
translate(t[1]) {
|
translate(t[1]) {
|
||||||
if (rightside){ //ang >= 0) {
|
frame_map(y=delt, z=UP)
|
||||||
rotate(90-ang)
|
rotate_extrude(angle=ang)
|
||||||
frame_map(x=-delt, z=UP)
|
if (ang<0)
|
||||||
rotate_extrude(angle=ang)
|
|
||||||
right_half(planar=true) children();
|
right_half(planar=true) children();
|
||||||
} else {
|
else
|
||||||
rotate(-(90-ang))
|
left_half(planar=true) children();
|
||||||
frame_map(x=delt, z=UP)
|
|
||||||
rotate_extrude(angle=-ang)
|
|
||||||
left_half(planar=true) children();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (caps) {
|
if (caps) {
|
||||||
|
|
Loading…
Reference in a new issue