Hello,
Is there an equivalent of offset() which can be applied to a list of 2d points instead of a polygon?
In some library, maybe?
Thank you in advance.
Sounds like stroke(path, width=3); in bosl2:
https://github.com/revarbat/BOSL2/wiki/Tutorial-Paths
On Fri, Apr 8, 2022 at 10:27 AM roald.baudoux@brutele.be wrote:
Hello,
Is there an equivalent of offset() which can be applied to a list of 2d
points instead of a polygon?
In some library, maybe?
Thank you in advance.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Actually what you want is the BOSL2 offset() function:
https://github.com/revarbat/BOSL2/wiki/regions.scad#function-offset
See example 12 for a case of a non-polygon.
Note that the dotSCAD library also has an offset capability.
On Fri, Apr 8, 2022 at 1:31 PM David Phillip Oster
davidphilliposter@gmail.com wrote:
Sounds like stroke(path, width=3); in bosl2: https://github.com/revarbat/BOSL2/wiki/Tutorial-Paths
On Fri, Apr 8, 2022 at 10:27 AM roald.baudoux@brutele.be wrote:
Hello,
Is there an equivalent of offset() which can be applied to a list of 2d points instead of a polygon?
In some library, maybe?
Thank you in advance.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Thank you! BOSL2’s offset does the trick but it’s slow.
I am currently adapting my full code to use this function but might try the function from dotSCAD afterwards (bijection_offset).
A robust offset is very hard to do in OpenSCAD and is not likely to be
fast. I think that in dotSCAD you have to use two functions, the
bijection_offset, which creates a "tangled" curve and then an
untangler. It's the "untangling" that is hard---that is, removing the
invalid parts of the curve generated by a naive offset. If your
curve doesn't have sharp curves you may be able to set check_valid in
BOSL2's offset() to false. Or you may be able to set quality to zero.
Depends on your curve. You might also consider using fewer points if
you're finding that the run time is a problem. How slow is "slow"?
The offset_sweep module can run offset() 30 times and it runs usually
in a few seconds.
On Fri, Apr 8, 2022 at 2:43 PM roald.baudoux@brutele.be wrote:
Thank you! BOSL2’s offset does the trick but it’s slow.
I am currently adapting my full code to use this function but might try the function from dotSCAD afterwards (bijection_offset).
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
you can try this function I wrote few months ago, this works most of the
time
function f_offset(sec,d) in
https://github.com/sprabhakar2006/openSCAD/blob/main/dependencies.scad
On Sat, 9 Apr 2022 at 00:13, roald.baudoux@brutele.be wrote:
Thank you! BOSL2’s offset does the trick but it’s slow.
I am currently adapting my full code to use this function but might try
the function from dotSCAD afterwards (bijection_offset).
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
for very simple use cases where there are no corner radiuses, function
offst(sec,r) could be used.
On Sat, 9 Apr 2022 at 05:52, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:
you can try this function I wrote few months ago, this works most of the
time
function f_offset(sec,d) in
https://github.com/sprabhakar2006/openSCAD/blob/main/dependencies.scad
On Sat, 9 Apr 2022 at 00:13, roald.baudoux@brutele.be wrote:
Thank you! BOSL2’s offset does the trick but it’s slow.
I am currently adapting my full code to use this function but might try
the function from dotSCAD afterwards (bijection_offset).
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I’ve tried BOSL2’s offset function. It functions quite well with the preview but not with the full rendering.
What’s wrong?
use <dotSCAD/src/loft.scad>;
include <BOSL2/std.scad> // for offset
stages =200;
stage_height = 1.25;
rad = 50;
f1 = 25;
f2 = 25;
phase1 = 0;
phase2 = 180;
height_depth=5;
depth1 = 20;
depth2 = 20;
thickness = 2;
bottom_thickness = 3;
myslices = 5;
angle_step=0.1;
// generate outer points
points_base = [for (i = [0:1:stages]) let(f = pow(sin(i/stages * 120),2) * 7 + 1, var = 1 , a=((sin((i/stages*360*f)%360) * 0.5 + 0.5) * (var * height_depth))) [for(j = [0:angle_step:360-angle_step]) [sin(j) * (rad+a+(pauw(sin(j *f1+phase1),0.5)*0.5+0.5)*depth1*i/stages+(pauw(sin(j *f2+phase2),0.5)*0.5+0.5)*depth2*(1-i/stages)), cos(j) *(rad+a+(pauw(sin(j *f1+phase1),0.5)*0.5+0.5)*depth1*i/stages+(pauw(sin(j *f2+phase2),0.5)*0.5+0.5)*depth2*(1-i/stages))]]];
// generate inner points with offset from outer points for hollowing out
points_base_e = [for (i = [0:1:stages]) offset(points_base[i],r=-thickness, closed=true, quality=1)];
// points - outside
points = [for (i = [0:1:stages-1]) [for (j = [0:1:(len(points_base[i])-1)]) concat(points_base[i][j][0],points_base[i][j][1],i * stage_height)]];
// points - inside
points_e = [for (i = [0:1:stages]) [for (j = [0:1:(len(points_base_e[i])-1)]) concat(points_base_e[i][j][0],points_base_e[i][j][1],i * stage_height)]];
//echo("points: ", points);
// separate points in packs for stepped extrusion
steps = [for (i = [0:1:stages-1]) points[i]];
steps_e = [for (i = [0:1:stages]) points_e[i]];
// extrusion with dotSCAD's loft function
difference() {
loft(steps,slices = myslices);
difference() {
loft(steps_e,slices = myslices);
cylinder(h = bottom_thickness, r = rad \* 2 + 20, center=true);
}
}
//======================== FUNCTIONS
function elbow(i,a,b,c) = lookup(i, [[0,a],[0.5,b],[1,c]]);
function elbow2(i,a,b,c,d) = lookup(i, [[0,a],[0.33333,b],[0.66666,c],[1,d]]);
function pauw(x,p) = sign(x) * pow(abs(x),p);
Thank you Sanjeev. However f_offset() seems quite slow. I’ve been trying to get just a preview and after several hours the progress bar is still not displayed.
Oh
Can you share your code or a picture for which offset is required
On Mon, 11 Apr 2022, 14:10 , roald.baudoux@brutele.be wrote:
Thank you Sanjeev. However f_offset() seems quite slow. I’ve been trying
to get just a preview and after several hours the progress bar is still not
displayed.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org