When I code this:
|include <BOSL2/std.scad> sinewave = [for(i=[-10:10:360 + 10])
[i/40,4*sin(i)]]; path_sweep2d(square(1), sinewave); |
I end up with this:
The left part of the sine is pretty, but the right side has a kink. Any
idea why this is so? Any idea how to fix the kink?
I ran into this just today. Play with the attach parameter in the sweep.
On Fri, Feb 11, 2022 at 9:17 PM jon jon@jonbondy.com wrote:
When I code this:
include <BOSL2/std.scad>
sinewave = [for(i=[-10:10:360 + 10]) [i/40,4*sin(i)]];
path_sweep2d(square(1), sinewave);
I end up with this:
The left part of the sine is pretty, but the right side has a kink. Any
idea why this is so? Any idea how to fix the kink?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 2/11/2022 7:16 PM, jon wrote:
When I code this:
|include <BOSL2/std.scad> sinewave = [for(i=[-10:10:360 + 10])
[i/40,4*sin(i)]]; path_sweep2d(square(1), sinewave); |
I think Adrian is on East Coast time and I don't know where Revar is, so
I'll take a stab at this.
I think your problem is that square() has one corner of the square at
the origin, and it is that corner that is swept along the path. That
asymmetry means that the resulting form is asymmetrical. The square
will always be on one side of the path, and so the result will be
different at the tops of the sine waves than at the bottoms.
Try square(1, center=true).
Note that the example given in the documentation uses circle(), which is
centered around the origin.
Perhaps this will be more obvious if I use a teardrop pointed at the
origin, instead of a square.
include <BOSL2/std.scad>
sinewave = [for(i=[-10:10:720 + 10]) [i/40,4*sin(i)]];
td = zrot(135, translate([0,-7.7], teardrop2d(r=2,ang=15)));
path_sweep2d(td, sinewave);
(And with respect to the magic number -7.7, I suspect that there's a way
to get BOSL2 to put the tip at the origin using anchors, but so far I
have failed.)
Yes, this is exactly the answer to the problem. To position the
teardrop you do teardrop2d(r=2,ang=15,anchor=BACK) or alternatively,
teardrop2(r=2,ang=15,anchor=[0,1]). The reason TOP didn't work is
that it points in the Z direction. I am wondering if it would make
sense to have some special case handling that converts TOP and BOTTOM
into BACK and FORWARD for 2d objects.
Here's a visualization of what's happening in the original example
where the red line shows your sweep path and you can see how the
constructed object follow the path.
include <BOSL2/std.scad>
sinewave = [for(i=[-10:10:360 + 10]) [i/40,4*sin(i)]];
%path_sweep2d(square(1), sinewave);
color("red")stroke(path3d(sinewave),width=.1);
On Fri, Feb 11, 2022 at 11:30 PM Jordan Brown
openscad@jordan.maileater.net wrote:
On 2/11/2022 7:16 PM, jon wrote:
When I code this:
include <BOSL2/std.scad>
sinewave = [for(i=[-10:10:360 + 10]) [i/40,4*sin(i)]];
path_sweep2d(square(1), sinewave);
I think Adrian is on East Coast time and I don't know where Revar is, so I'll take a stab at this.
I think your problem is that square() has one corner of the square at the origin, and it is that corner that is swept along the path. That asymmetry means that the resulting form is asymmetrical. The square will always be on one side of the path, and so the result will be different at the tops of the sine waves than at the bottoms.
Try square(1, center=true).
Note that the example given in the documentation uses circle(), which is centered around the origin.
Perhaps this will be more obvious if I use a teardrop pointed at the origin, instead of a square.
include <BOSL2/std.scad>
sinewave = [for(i=[-10:10:720 + 10]) [i/40,4*sin(i)]];
td = zrot(135, translate([0,-7.7], teardrop2d(r=2,ang=15)));
path_sweep2d(td, sinewave);
(And with respect to the magic number -7.7, I suspect that there's a way to get BOSL2 to put the tip at the origin using anchors, but so far I have failed.)
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org