discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Odd shapes with domes

JW
Joe Weinpert
Sat, Jan 8, 2022 8:48 PM

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.

What is the best way to add a solid dome top to an odd shaped solid object? For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.
RW
Raymond West
Sat, Jan 8, 2022 9:17 PM

use hull -

//odd shape
module shape(){
    linear_extrude(20,convexity =10){
        polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
        }}

    $fn=80;
        hull(){
          shape();
          translate([0,6,20]) sphere(10); //locate maybe by trial and error
        }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid
object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

use hull - //odd shape module shape(){     linear_extrude(20,convexity =10){         polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);         }}     $fn=80;         hull(){           shape();           translate([0,6,20]) sphere(10); //locate maybe by trial and error         } On 08/01/2022 20:48, Joe Weinpert wrote: > > What is the best way to add a solid dome top to an odd shaped solid > object? > > For example: take a kidney or a heart shaped solid object with > vertical sides an add a rounded top to it. > > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
AM
Adrian Mariano
Sat, Jan 8, 2022 9:19 PM

What exactly does "rounded top" mean?  There are some ugly hacks
involving a massive union of offset or scaled parts forming a
stairstep model.  I think the best way to do this is to construct
your shape as a polyhedron with the desired rounded top.  To do this
easily, you can make your shape as a point list and then use a
library.  For example:

include <BOSL2/std.scad>
include <BOSL2/rounding.scad>

shape = supershape(step=2,m1=2, n1=1, n2=4, n3=8);
offset_sweep(shape, top = os_circle(r=1), height=2);

tlist = [ident(4),
for(i=[0:15]) let(z=i/15) up(1+z)scale(sqrt(1-(z.99)^2))
];

right(3)
sweep(shape, tlist);

The first method shown here (offset_sweep) makes a circular rounded
top.  But weird shapes don't have well behaved circular rounded tops.
That is, you get creases and degenerate behavior.  So you might need
to think about what you mean, exactly, when asking for a rounded top.
If you scale instead of offsetting you'll get something with a
rounded top that varies in its curvature and amount of rounding, but
avoids degeneracy.  And it probably involves more experimentation with
parameters to get the curve you want for the top.  But maybe that's
what you want?  That's the second version.  Both can be seen here:

On Sat, Jan 8, 2022 at 3:48 PM Joe Weinpert joe.weinpert@gmail.com wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

What exactly does "rounded top" mean? There are some ugly hacks involving a massive union of offset or scaled parts forming a stairstep model. I think the best way to do this is to construct your shape as a polyhedron with the desired rounded top. To do this easily, you can make your shape as a point list and then use a library. For example: include <BOSL2/std.scad> include <BOSL2/rounding.scad> shape = supershape(step=2,m1=2, n1=1, n2=4, n3=8); offset_sweep(shape, top = os_circle(r=1), height=2); tlist = [ident(4), for(i=[0:15]) let(z=i/15) up(1+z)*scale(sqrt(1-(z*.99)^2)) ]; right(3) sweep(shape, tlist); The first method shown here (offset_sweep) makes a circular rounded top. But weird shapes don't have well behaved circular rounded tops. That is, you get creases and degenerate behavior. So you might need to think about what you mean, exactly, when asking for a rounded top. If you scale instead of offsetting you'll get something with a rounded top that varies in its curvature and amount of rounding, but avoids degeneracy. And it probably involves more experimentation with parameters to get the curve you want for the top. But maybe that's what you want? That's the second version. Both can be seen here: On Sat, Jan 8, 2022 at 3:48 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > > > What is the best way to add a solid dome top to an odd shaped solid object? > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
AM
Adrian Mariano
Sat, Jan 8, 2022 9:24 PM

Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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

Both of his proposed shapes, a heart, and a kidney, are concave. So hull() is not going to do the job at all. On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: > > use hull - > > //odd shape > module shape(){ > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); > }} > > $fn=80; > hull(){ > shape(); > translate([0,6,20]) sphere(10); //locate maybe by trial and error > } > > On 08/01/2022 20:48, Joe Weinpert wrote: > > > What is the best way to add a solid dome top to an odd shaped solid object? > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > > _______________________________________________ > 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
RW
Raymond West
Sat, Jan 8, 2022 10:09 PM

Well, you can always split it on the inclusion, and fiddle it until it
looks the way you want.

//odd shape
module shape(){  //with inclusion
    linear_extrude(20,convexity =10){
        polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

        }}

 module shape2(){
          shape();
          translate([5,6,20]) sphere(6); //locate maybe by trial and error
      }

  module part1(){
      intersection(){
        translate ([-20,5,0])
        cube(50);
        shape2();
       }
    }
  module part2(){
        difference(){
            shape2();
            part1();
        }
    }

    $fn=80;
       hull() part2();
       hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:

Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. //odd shape module shape(){  //with inclusion     linear_extrude(20,convexity =10){         polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);         }}  module shape2(){           shape();           translate([5,6,20]) sphere(6); //locate maybe by trial and error       }   module part1(){       intersection(){         translate ([-20,5,0])         cube(50);         shape2();        }     }   module part2(){         difference(){             shape2();             part1();         }     }     $fn=80;        hull() part2();        hull() part1(); On 08/01/2022 21:24, Adrian Mariano wrote: > Both of his proposed shapes, a heart, and a kidney, are concave. So > hull() is not going to do the job at all. > > On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >> use hull - >> >> //odd shape >> module shape(){ >> linear_extrude(20,convexity =10){ >> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >> }} >> >> $fn=80; >> hull(){ >> shape(); >> translate([0,6,20]) sphere(10); //locate maybe by trial and error >> } >> >> On 08/01/2022 20:48, Joe Weinpert wrote: >> >> >> What is the best way to add a solid dome top to an odd shaped solid object? >> >> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >> >> >> >> >> >> _______________________________________________ >> 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 > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
MM
Michael McCool
Sat, Jan 8, 2022 10:22 PM

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:
Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:
use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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

Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. (From: Michael McCool) > On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: > > Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. > > //odd shape > module shape(){ //with inclusion > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); > > }} > > module shape2(){ > shape(); > translate([5,6,20]) sphere(6); //locate maybe by trial and error > } > > module part1(){ > intersection(){ > translate ([-20,5,0]) > cube(50); > shape2(); > } > } > module part2(){ > difference(){ > shape2(); > part1(); > } > } > > $fn=80; > hull() part2(); > hull() part1(); > >> On 08/01/2022 21:24, Adrian Mariano wrote: >> Both of his proposed shapes, a heart, and a kidney, are concave. So >> hull() is not going to do the job at all. >> >>> On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >>> use hull - >>> >>> //odd shape >>> module shape(){ >>> linear_extrude(20,convexity =10){ >>> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >>> }} >>> >>> $fn=80; >>> hull(){ >>> shape(); >>> translate([0,6,20]) sphere(10); //locate maybe by trial and error >>> } >>> >>>> On 08/01/2022 20:48, Joe Weinpert wrote: >>> >>> >>> What is the best way to add a solid dome top to an odd shaped solid object? >>> >>> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >>> >>> >>> >>> >>> >>> _______________________________________________ >>> 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 >> _______________________________________________ >> 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
MM
Michael McCool
Sat, Jan 8, 2022 10:23 PM

Sorry, I meant “the scale parameter to linear extrude will not do the right thing”.

(From: Michael McCool)

On Jan 8, 2022, at 18:22, Michael McCool michael.d.mccool@gmail.com wrote:

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:
Both of his proposed shapes, a heart, and a kidney, are concave.  So
hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:
use hull -

//odd shape
module shape(){
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);
}}

 $fn=80;
     hull(){
       shape();
       translate([0,6,20]) sphere(10); //locate maybe by trial and error
     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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

Sorry, I meant “the scale parameter to linear extrude will not do the right thing”. (From: Michael McCool) > On Jan 8, 2022, at 18:22, Michael McCool <michael.d.mccool@gmail.com> wrote: > > Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. > > The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad > > Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. > > (From: Michael McCool) > >>> On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: >>> >> Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. >> >> //odd shape >> module shape(){ //with inclusion >> linear_extrude(20,convexity =10){ >> polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); >> >> }} >> >> module shape2(){ >> shape(); >> translate([5,6,20]) sphere(6); //locate maybe by trial and error >> } >> >> module part1(){ >> intersection(){ >> translate ([-20,5,0]) >> cube(50); >> shape2(); >> } >> } >> module part2(){ >> difference(){ >> shape2(); >> part1(); >> } >> } >> >> $fn=80; >> hull() part2(); >> hull() part1(); >> >>> On 08/01/2022 21:24, Adrian Mariano wrote: >>> Both of his proposed shapes, a heart, and a kidney, are concave. So >>> hull() is not going to do the job at all. >>> >>>> On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: >>>> use hull - >>>> >>>> //odd shape >>>> module shape(){ >>>> linear_extrude(20,convexity =10){ >>>> polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); >>>> }} >>>> >>>> $fn=80; >>>> hull(){ >>>> shape(); >>>> translate([0,6,20]) sphere(10); //locate maybe by trial and error >>>> } >>>> >>>>> On 08/01/2022 20:48, Joe Weinpert wrote: >>>> >>>> >>>> What is the best way to add a solid dome top to an odd shaped solid object? >>>> >>>> For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> 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 >>> _______________________________________________ >>> 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
AM
Adrian Mariano
Sun, Jan 9, 2022 12:21 AM

The example I posted does what you said, using BOSL2 to perform the
offsets and linking the layers together, which is better done with
offset_sweep, because it is smart about how it connects adjacent
layers.  You'll probably get an inferior result with skin, and it will
be more work, since you'll have to compute the layers yourself.

But note that we don't know what "the right thing" is without more
information from the original poster.  Perhaps scaled layers are
preferred---they avoid degeneracies in the layers that are likely to
arise with offset. If you use offset you'll have edges appear, so the
"rounded top" will have corners.  The smoother top resulting from
scale operations might be "best" in the eyes of the original poster.

On Sat, Jan 8, 2022 at 5:22 PM Michael McCool
michael.d.mccool@gmail.com wrote:

Let’s assume the outline we want to use is in fact a 2D contour.  The “right” way to do this is probably to generate a series of offsets, then “skin” between each one.

The offset part is easy, there is an “offset” function.  For skinning the two curves, “hull” will not do the right thing if there are concavities.  The scale parameter to linear offset will also not do the right thing.  A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad

Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule).  There are also two variants of offset that might give different results.

(From: Michael McCool)

On Jan 8, 2022, at 18:09, Raymond West raywest@raywest.com wrote:

Well, you can always split it on the inclusion, and fiddle it until it looks the way you want.

//odd shape
module shape(){  //with inclusion
linear_extrude(20,convexity =10){
polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]);

     }}

module shape2(){
shape();
translate([5,6,20]) sphere(6); //locate maybe by trial and error
}

module part1(){
intersection(){
translate ([-20,5,0])
cube(50);
shape2();
}
}
module part2(){
difference(){
shape2();
part1();
}
}

 $fn=80;
    hull() part2();
    hull() part1();

On 08/01/2022 21:24, Adrian Mariano wrote:

Both of his proposed shapes, a heart, and a kidney, are concave.  So

hull() is not going to do the job at all.

On Sat, Jan 8, 2022 at 4:17 PM Raymond West raywest@raywest.com wrote:

use hull -

//odd shape

module shape(){

 linear_extrude(20,convexity =10){

     polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]);

     }}


 $fn=80;

     hull(){

       shape();

       translate([0,6,20]) sphere(10); //locate maybe by trial and error

     }

On 08/01/2022 20:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it.


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


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


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

The example I posted does what you said, using BOSL2 to perform the offsets and linking the layers together, which is better done with offset_sweep, because it is smart about how it connects adjacent layers. You'll probably get an inferior result with skin, and it will be more work, since you'll have to compute the layers yourself. But note that we don't know what "the right thing" is without more information from the original poster. Perhaps scaled layers are preferred---they avoid degeneracies in the layers that are likely to arise with offset. If you use offset you'll have edges appear, so the "rounded top" will have corners. The smoother top resulting from scale operations might be "best" in the eyes of the original poster. On Sat, Jan 8, 2022 at 5:22 PM Michael McCool <michael.d.mccool@gmail.com> wrote: > > Let’s assume the outline we want to use is in fact a 2D contour. The “right” way to do this is probably to generate a series of offsets, then “skin” between each one. > > The offset part is easy, there is an “offset” function. For skinning the two curves, “hull” will not do the right thing if there are concavities. The scale parameter to linear offset will also not do the right thing. A bit of googling though did turn up some libraries, for instance this one: https://github-wiki-see.page/m/revarbat/BOSL2/wiki/skin.scad > > Also, you want to have the right offsets and z values for a set of slices, but that’s something to play with (could start with a quarter circle schedule). There are also two variants of offset that might give different results. > > (From: Michael McCool) > > On Jan 8, 2022, at 18:09, Raymond West <raywest@raywest.com> wrote: > > Well, you can always split it on the inclusion, and fiddle it until it looks the way you want. > > //odd shape > module shape(){ //with inclusion > linear_extrude(20,convexity =10){ > polygon(points=[[-10,-10],[0,5],[-10,15],[15,18],[9,-1]]); > > }} > > module shape2(){ > shape(); > translate([5,6,20]) sphere(6); //locate maybe by trial and error > } > > module part1(){ > intersection(){ > translate ([-20,5,0]) > cube(50); > shape2(); > } > } > module part2(){ > difference(){ > shape2(); > part1(); > } > } > > $fn=80; > hull() part2(); > hull() part1(); > > On 08/01/2022 21:24, Adrian Mariano wrote: > > Both of his proposed shapes, a heart, and a kidney, are concave. So > > hull() is not going to do the job at all. > > > On Sat, Jan 8, 2022 at 4:17 PM Raymond West <raywest@raywest.com> wrote: > > use hull - > > > //odd shape > > module shape(){ > > linear_extrude(20,convexity =10){ > > polygon(points=[[-10,-10],[-10,15],[15,18],[9,-1]]); > > }} > > > $fn=80; > > hull(){ > > shape(); > > translate([0,6,20]) sphere(10); //locate maybe by trial and error > > } > > > On 08/01/2022 20:48, Joe Weinpert wrote: > > > > What is the best way to add a solid dome top to an odd shaped solid object? > > > For example: take a kidney or a heart shaped solid object with vertical sides an add a rounded top to it. > > > > > > > _______________________________________________ > > 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 > > _______________________________________________ > > 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 > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 12:36 AM

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.

Can anyone suggest the logic of offset for a closed 2d complex shape. I am struggling to figure out. Main challenge comes when the offset values become larger.
AM
Adrian Mariano
Sun, Jan 9, 2022 6:10 AM

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Doing offset is very difficult. You can take a look at BOSL2 and also dotSCAD which both have implementations. The BOSL2 algorithm can fail under various circumstances. I don't know how robust the dotSCAD method is. There is a more robust algorithm that relies on reliable bolean operations. See "Polygon Offsetting by Computing Winding Numbers" by Chen and McMains. A disadvantage of this method, however, is that it becomes impossible to maintain the relationship between points in the original and points in the offset, which are needed for connecting the layers to make the polyhedron. On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > Can anyone suggest the logic of offset for a closed 2d complex shape. > > I am struggling to figure out. > > Main challenge comes when the offset values become larger. > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 6:41 AM

Thanks for your explanation.
dotscad also fails in many cases.
Will read the reference mentioned

On Sun, 9 Jan 2022, 11:40 Adrian Mariano, avm4@cornell.edu wrote:

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


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

Thanks for your explanation. dotscad also fails in many cases. Will read the reference mentioned On Sun, 9 Jan 2022, 11:40 Adrian Mariano, <avm4@cornell.edu> wrote: > Doing offset is very difficult. You can take a look at BOSL2 and also > dotSCAD which both have implementations. The BOSL2 algorithm can > fail under various circumstances. I don't know how robust the dotSCAD > method is. There is a more robust algorithm that relies on reliable > bolean operations. See "Polygon Offsetting by Computing Winding > Numbers" by Chen and McMains. > A disadvantage of this method, however, is that it becomes impossible > to maintain the > relationship between points in the original and points in the offset, > which are needed for connecting the layers to make the polyhedron. > > On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar > <sprabhakar2006@gmail.com> wrote: > > > > Can anyone suggest the logic of offset for a closed 2d complex shape. > > > > I am struggling to figure out. > > > > Main challenge comes when the offset values become larger. > > > > > > > > > > _______________________________________________ > > 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 >
CA
Carsten Arnholm
Sun, Jan 9, 2022 7:55 AM

On 08.01.2022 21:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.

The problem is not completely defined, but you could

  1. project the original heart shaped object to the XY plane and obtain a
    2d shape, which would be typically concave.

  2. Linear extrude the 2d shape to some height that is higher than the
    "dome" you envisage. Then you have a concave 3d cylinder.

  3. Intersect the 3d cylinder with e.g. a sphere with center at the base
    of the cylinder. You now have a 3d "dome".

  4. Translate the "dome" to union it with the original heart.

Carsten Arnholm

On 08.01.2022 21:48, Joe Weinpert wrote: > > What is the best way to add a solid dome top to an odd shaped solid object? > > For example: take a kidney or a heart shaped solid object with > vertical sides an add a rounded top to it. The problem is not completely defined, but you could 1. project the original heart shaped object to the XY plane and obtain a 2d shape, which would be typically concave. 2. Linear extrude the 2d shape to some height that is higher than the "dome" you envisage. Then you have a concave 3d cylinder. 3. Intersect the 3d cylinder with e.g. a sphere with center at the base of the cylinder. You now have a 3d "dome". 4. Translate the "dome" to union it with the original heart. Carsten Arnholm
AR
Algot Runeman
Sun, Jan 9, 2022 1:39 PM

On 1/9/22 2:55 AM, Carsten Arnholm wrote:

On 08.01.2022 21:48, Joe Weinpert wrote:

What is the best way to add a solid dome top to an odd shaped solid
object?

For example: take a kidney or a heart shaped solid object with
vertical sides an add a rounded top to it.

The problem is not completely defined, but you could

  1. project the original heart shaped object to the XY plane and obtain
    a 2d shape, which would be typically concave.

  2. Linear extrude the 2d shape to some height that is higher than the
    "dome" you envisage. Then you have a concave 3d cylinder.

  3. Intersect the 3d cylinder with e.g. a sphere with center at the
    base of the cylinder. You now have a 3d "dome".

  4. Translate the "dome" to union it with the original heart.

Carsten Arnholm

Based on Carsten Arnholm's suggestion, here is some code from which Joe
Weinpert might start.

intersection(){
linear_extrude(90)
polygon(points=[[0,0],[70,60],[70,110],[50,130],[20,130],[0,110],[-20,130],[-50,130],[-70,110],[-70,60]]);
// blocky heart shape
translate([0,80,0])
    sphere(90);
}

On 1/9/22 2:55 AM, Carsten Arnholm wrote: > On 08.01.2022 21:48, Joe Weinpert wrote: >> >> What is the best way to add a solid dome top to an odd shaped solid >> object? >> >> For example: take a kidney or a heart shaped solid object with >> vertical sides an add a rounded top to it. > > The problem is not completely defined, but you could > > 1. project the original heart shaped object to the XY plane and obtain > a 2d shape, which would be typically concave. > > 2. Linear extrude the 2d shape to some height that is higher than the > "dome" you envisage. Then you have a concave 3d cylinder. > > 3. Intersect the 3d cylinder with e.g. a sphere with center at the > base of the cylinder. You now have a 3d "dome". > > 4. Translate the "dome" to union it with the original heart. > > Carsten Arnholm > Based on Carsten Arnholm's suggestion, here is some code from which Joe Weinpert might start. intersection(){ linear_extrude(90) polygon(points=[[0,0],[70,60],[70,110],[50,130],[20,130],[0,110],[-20,130],[-50,130],[-70,110],[-70,60]]); // blocky heart shape translate([0,80,0])     sphere(90); }
AM
Adrian Mariano
Sun, Jan 9, 2022 3:34 PM

I haven't experimented with the dotSCAD implementation of offset, but
I think you have to do it in two steps, first one that generates the
offset and a second one to remove the extra, invalid loops.  You find
it to fail in many cases?  The BOSL2 version works OK usually unless
you are near the singularity where the object starts to disappear.
It also doesn't handle the case where the offset is multiple
disconnected regions.  Do you have some specific test case where both
are failing?

Carsten's solution to the dome problem is probably the best way to do
it directly in OpenSCAD.  You may need to scale the sphere into some
kind of ellipsoid if the starting shape is not roughly circular, but
it is a nice approach.

On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks for your explanation.
dotscad also fails in many cases.
Will read the reference mentioned

On Sun, 9 Jan 2022, 11:40 Adrian Mariano, avm4@cornell.edu wrote:

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


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


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I haven't experimented with the dotSCAD implementation of offset, but I think you have to do it in two steps, first one that generates the offset and a second one to remove the extra, invalid loops. You find it to fail in many cases? The BOSL2 version works OK usually unless you are near the singularity where the object starts to disappear. It also doesn't handle the case where the offset is multiple disconnected regions. Do you have some specific test case where both are failing? Carsten's solution to the dome problem is probably the best way to do it directly in OpenSCAD. You may need to scale the sphere into some kind of ellipsoid if the starting shape is not roughly circular, but it is a nice approach. On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > Thanks for your explanation. > dotscad also fails in many cases. > Will read the reference mentioned > > On Sun, 9 Jan 2022, 11:40 Adrian Mariano, <avm4@cornell.edu> wrote: >> >> Doing offset is very difficult. You can take a look at BOSL2 and also >> dotSCAD which both have implementations. The BOSL2 algorithm can >> fail under various circumstances. I don't know how robust the dotSCAD >> method is. There is a more robust algorithm that relies on reliable >> bolean operations. See "Polygon Offsetting by Computing Winding >> Numbers" by Chen and McMains. >> A disadvantage of this method, however, is that it becomes impossible >> to maintain the >> relationship between points in the original and points in the offset, >> which are needed for connecting the layers to make the polyhedron. >> >> On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar >> <sprabhakar2006@gmail.com> wrote: >> > >> > Can anyone suggest the logic of offset for a closed 2d complex shape. >> > >> > I am struggling to figure out. >> > >> > Main challenge comes when the offset values become larger. >> > >> > >> > >> > >> > _______________________________________________ >> > 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 > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 4:26 PM

i have attached an example here.
file name is "example of offset issue.scad"
there is a "dependencies.scad" file which has the offset function (I have
tried to resolve all the errors due to openSCAD version issues).
there are 2 of them offst and o_set.
o_set works better but since the number of points are removed, it is not
very useful for 3d operations.
please have a look and suggest, if there is anything possible.

I case this is done, it will really help.

On Sun, 9 Jan 2022 at 21:04, Adrian Mariano avm4@cornell.edu wrote:

I haven't experimented with the dotSCAD implementation of offset, but
I think you have to do it in two steps, first one that generates the
offset and a second one to remove the extra, invalid loops.  You find
it to fail in many cases?  The BOSL2 version works OK usually unless
you are near the singularity where the object starts to disappear.
It also doesn't handle the case where the offset is multiple
disconnected regions.  Do you have some specific test case where both
are failing?

Carsten's solution to the dome problem is probably the best way to do
it directly in OpenSCAD.  You may need to scale the sphere into some
kind of ellipsoid if the starting shape is not roughly circular, but
it is a nice approach.

On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks for your explanation.
dotscad also fails in many cases.
Will read the reference mentioned

On Sun, 9 Jan 2022, 11:40 Adrian Mariano, avm4@cornell.edu wrote:

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


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


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

i have attached an example here. file name is "example of offset issue.scad" there is a "dependencies.scad" file which has the offset function (I have tried to resolve all the errors due to openSCAD version issues). there are 2 of them offst and o_set. o_set works better but since the number of points are removed, it is not very useful for 3d operations. please have a look and suggest, if there is anything possible. I case this is done, it will really help. On Sun, 9 Jan 2022 at 21:04, Adrian Mariano <avm4@cornell.edu> wrote: > I haven't experimented with the dotSCAD implementation of offset, but > I think you have to do it in two steps, first one that generates the > offset and a second one to remove the extra, invalid loops. You find > it to fail in many cases? The BOSL2 version works OK usually unless > you are near the singularity where the object starts to disappear. > It also doesn't handle the case where the offset is multiple > disconnected regions. Do you have some specific test case where both > are failing? > > Carsten's solution to the dome problem is probably the best way to do > it directly in OpenSCAD. You may need to scale the sphere into some > kind of ellipsoid if the starting shape is not roughly circular, but > it is a nice approach. > > On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar > <sprabhakar2006@gmail.com> wrote: > > > > Thanks for your explanation. > > dotscad also fails in many cases. > > Will read the reference mentioned > > > > On Sun, 9 Jan 2022, 11:40 Adrian Mariano, <avm4@cornell.edu> wrote: > >> > >> Doing offset is very difficult. You can take a look at BOSL2 and also > >> dotSCAD which both have implementations. The BOSL2 algorithm can > >> fail under various circumstances. I don't know how robust the dotSCAD > >> method is. There is a more robust algorithm that relies on reliable > >> bolean operations. See "Polygon Offsetting by Computing Winding > >> Numbers" by Chen and McMains. > >> A disadvantage of this method, however, is that it becomes impossible > >> to maintain the > >> relationship between points in the original and points in the offset, > >> which are needed for connecting the layers to make the polyhedron. > >> > >> On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar > >> <sprabhakar2006@gmail.com> wrote: > >> > > >> > Can anyone suggest the logic of offset for a closed 2d complex shape. > >> > > >> > I am struggling to figure out. > >> > > >> > Main challenge comes when the offset values become larger. > >> > > >> > > >> > > >> > > >> > _______________________________________________ > >> > 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 > > > > _______________________________________________ > > 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 >
AM
Adrian Mariano
Sun, Jan 9, 2022 7:45 PM

I think you will find that most offset strategies remove
points---usually people are not interested in retaining extra points.
When I talk about robustness I mean getting the right answer at all,
not getting the right answer and tracking the point mapping between
the original and offset curves.

I do not know what the content of your dependencies.scad is, but I
tried your example in BOSL2.  In order to get a correct result with an
offset of -5 I had to select quality=4.  I think this is because you
have excessively fine sampling, with lots of points very close
together.  The BOSL2 offset function removes points, but it also has
the option to provide the map between original points and removed
points so that you can link the points together.  This is how
offset_sweep works.  There are two reasons I haven't pursued the
winding number scheme from the paper for a more robust offset.  One of
them is that it only works on polygons, not on paths with endpoints.
The other is that it won't give the mapping I need for offset_sweep,
and I use offset_sweep in almost every model.

The result of offset sweep on your shape with a radius 5 "dome"
appears below.  Note also that even if points are removed, all is not
lost.  You can link points "intelligently" and perhaps get a decent
result.  The BOSL2 skin() function does NOT require that the layers
linked together have the same number of points and if you use the
"distance" method you can perhaps get a good result on an example like
this, though it may be slow with many points, since the algorithm for
linking points is O(N^3).

On Sun, Jan 9, 2022 at 11:45 AM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

i have attached an example here.
file name is "example of offset issue.scad"
there is a "dependencies.scad" file which has the offset function (I have tried to resolve all the errors due to openSCAD version issues).
there are 2 of them offst and o_set.
o_set works better but since the number of points are removed, it is not very useful for 3d operations.
please have a look and suggest, if there is anything possible.

I case this is done, it will really help.

On Sun, 9 Jan 2022 at 21:04, Adrian Mariano avm4@cornell.edu wrote:

I haven't experimented with the dotSCAD implementation of offset, but
I think you have to do it in two steps, first one that generates the
offset and a second one to remove the extra, invalid loops.  You find
it to fail in many cases?  The BOSL2 version works OK usually unless
you are near the singularity where the object starts to disappear.
It also doesn't handle the case where the offset is multiple
disconnected regions.  Do you have some specific test case where both
are failing?

Carsten's solution to the dome problem is probably the best way to do
it directly in OpenSCAD.  You may need to scale the sphere into some
kind of ellipsoid if the starting shape is not roughly circular, but
it is a nice approach.

On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks for your explanation.
dotscad also fails in many cases.
Will read the reference mentioned

On Sun, 9 Jan 2022, 11:40 Adrian Mariano, avm4@cornell.edu wrote:

Doing offset is very difficult.  You can take a look at BOSL2 and also
dotSCAD which both have implementations.  The BOSL2 algorithm can
fail under various circumstances.  I don't know how robust the dotSCAD
method is.  There is a more robust algorithm that relies on reliable
bolean operations.  See "Polygon Offsetting by Computing Winding
Numbers" by Chen and McMains.
A disadvantage of this method, however, is that it becomes impossible
to maintain the
relationship between points in the original and points in the offset,
which are needed for connecting the layers to make the polyhedron.

On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Can anyone suggest the logic of offset for a closed 2d complex shape.

I am struggling to figure out.

Main challenge comes when the offset values become larger.


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


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


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I think you will find that most offset strategies remove points---usually people are not interested in retaining extra points. When I talk about robustness I mean getting the right answer at all, not getting the right answer and tracking the point mapping between the original and offset curves. I do not know what the content of your dependencies.scad is, but I tried your example in BOSL2. In order to get a correct result with an offset of -5 I had to select quality=4. I think this is because you have excessively fine sampling, with lots of points very close together. The BOSL2 offset function removes points, but it also has the option to provide the map between original points and removed points so that you can link the points together. This is how offset_sweep works. There are two reasons I haven't pursued the winding number scheme from the paper for a more robust offset. One of them is that it only works on polygons, not on paths with endpoints. The other is that it won't give the mapping I need for offset_sweep, and I use offset_sweep in almost every model. The result of offset sweep on your shape with a radius 5 "dome" appears below. Note also that even if points are removed, all is not lost. You can link points "intelligently" and perhaps get a decent result. The BOSL2 skin() function does NOT require that the layers linked together have the same number of points and if you use the "distance" method you can perhaps get a good result on an example like this, though it may be slow with many points, since the algorithm for linking points is O(N^3). On Sun, Jan 9, 2022 at 11:45 AM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > i have attached an example here. > file name is "example of offset issue.scad" > there is a "dependencies.scad" file which has the offset function (I have tried to resolve all the errors due to openSCAD version issues). > there are 2 of them offst and o_set. > o_set works better but since the number of points are removed, it is not very useful for 3d operations. > please have a look and suggest, if there is anything possible. > > I case this is done, it will really help. > > > On Sun, 9 Jan 2022 at 21:04, Adrian Mariano <avm4@cornell.edu> wrote: >> >> I haven't experimented with the dotSCAD implementation of offset, but >> I think you have to do it in two steps, first one that generates the >> offset and a second one to remove the extra, invalid loops. You find >> it to fail in many cases? The BOSL2 version works OK usually unless >> you are near the singularity where the object starts to disappear. >> It also doesn't handle the case where the offset is multiple >> disconnected regions. Do you have some specific test case where both >> are failing? >> >> Carsten's solution to the dome problem is probably the best way to do >> it directly in OpenSCAD. You may need to scale the sphere into some >> kind of ellipsoid if the starting shape is not roughly circular, but >> it is a nice approach. >> >> On Sun, Jan 9, 2022 at 1:41 AM Sanjeev Prabhakar >> <sprabhakar2006@gmail.com> wrote: >> > >> > Thanks for your explanation. >> > dotscad also fails in many cases. >> > Will read the reference mentioned >> > >> > On Sun, 9 Jan 2022, 11:40 Adrian Mariano, <avm4@cornell.edu> wrote: >> >> >> >> Doing offset is very difficult. You can take a look at BOSL2 and also >> >> dotSCAD which both have implementations. The BOSL2 algorithm can >> >> fail under various circumstances. I don't know how robust the dotSCAD >> >> method is. There is a more robust algorithm that relies on reliable >> >> bolean operations. See "Polygon Offsetting by Computing Winding >> >> Numbers" by Chen and McMains. >> >> A disadvantage of this method, however, is that it becomes impossible >> >> to maintain the >> >> relationship between points in the original and points in the offset, >> >> which are needed for connecting the layers to make the polyhedron. >> >> >> >> On Sat, Jan 8, 2022 at 7:37 PM Sanjeev Prabhakar >> >> <sprabhakar2006@gmail.com> wrote: >> >> > >> >> > Can anyone suggest the logic of offset for a closed 2d complex shape. >> >> > >> >> > I am struggling to figure out. >> >> > >> >> > Main challenge comes when the offset values become larger. >> >> > >> >> > >> >> > >> >> > >> >> > _______________________________________________ >> >> > 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 >> > >> > _______________________________________________ >> > 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 > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 11:01 PM

Thanks very much for your answer
I will the bosl library and use the same for such applications.
Can you share the modified scad file

On Mon, 10 Jan 2022, 01:15 Adrian Mariano, avm4@cornell.edu wrote:

I think you will find that most offset strategies remove
points---usually people are not interested in retaining extra points.
When I talk about robustness I mean getting the right answer at all,
not getting the right answer and tracking the point mapping between
the original and offset curves.

I do not know what the content of your dependencies.scad is, but I
tried your example in BOSL2.  In order to get a correct result with an
offset of -5 I had to select quality=4.  I think this is because you
have excessively fine sampling, with lots of points very close
together.  The BOSL2 offset function removes points, but it also has
the option to provide the map between original points and removed
points so that you can link the points together.  This is how
offset_sweep works.  There are two reasons I haven't pursued the
winding number scheme from the paper for a more robust offset.  One of
them is that it only works on polygons, not on paths with endpoints.
The other is that it won't give the mapping I need for offset_sweep,
and I use offset_sweep in almost every model.

The result of offset sweep on your shape with a radius 5 "dome"
appears below.  Note also that even if points are removed, all is not
lost.  You can link points "intelligently" and perhaps get a decent
result.  The BOSL2 skin() function does NOT require that the layers
linked together have the same number of points and if you use the
"distance" method you can perhaps get a good result on an example like
this, though it may be slow with many points, since the algorithm for
linking points is O(N^3).

Thanks very much for your answer I will the bosl library and use the same for such applications. Can you share the modified scad file On Mon, 10 Jan 2022, 01:15 Adrian Mariano, <avm4@cornell.edu> wrote: > I think you will find that most offset strategies remove > points---usually people are not interested in retaining extra points. > When I talk about robustness I mean getting the right answer at all, > not getting the right answer and tracking the point mapping between > the original and offset curves. > > I do not know what the content of your dependencies.scad is, but I > tried your example in BOSL2. In order to get a correct result with an > offset of -5 I had to select quality=4. I think this is because you > have excessively fine sampling, with lots of points very close > together. The BOSL2 offset function removes points, but it also has > the option to provide the map between original points and removed > points so that you can link the points together. This is how > offset_sweep works. There are two reasons I haven't pursued the > winding number scheme from the paper for a more robust offset. One of > them is that it only works on polygons, not on paths with endpoints. > The other is that it won't give the mapping I need for offset_sweep, > and I use offset_sweep in almost every model. > > The result of offset sweep on your shape with a radius 5 "dome" > appears below. Note also that even if points are removed, all is not > lost. You can link points "intelligently" and perhaps get a decent > result. The BOSL2 skin() function does NOT require that the layers > linked together have the same number of points and if you use the > "distance" method you can perhaps get a good result on an example like > this, though it may be slow with many points, since the algorithm for > linking points is O(N^3). > > >
AM
Adrian Mariano
Sun, Jan 9, 2022 11:30 PM

Your code for computing the polygon relied on something inside
dependencies.scad that conflicted with BOSL2, so I just printed out
the contents of that path to use with BOSL2.  To create a domed shape
based on an input pointlist:

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>

offset_sweep(pointlist, height=10, top=os_circle(r=5));

You need height to be larger than the radius given for the top, or you
can omit height entirely and you'll just get the dome.  The
offset_sweep() function is pretty complicated, with lots of options.
To learn how to use it, go here:

https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep

On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks very much for your answer
I will the bosl library and use the same for such applications.
Can you share the modified scad file

On Mon, 10 Jan 2022, 01:15 Adrian Mariano, avm4@cornell.edu wrote:

I think you will find that most offset strategies remove
points---usually people are not interested in retaining extra points.
When I talk about robustness I mean getting the right answer at all,
not getting the right answer and tracking the point mapping between
the original and offset curves.

I do not know what the content of your dependencies.scad is, but I
tried your example in BOSL2.  In order to get a correct result with an
offset of -5 I had to select quality=4.  I think this is because you
have excessively fine sampling, with lots of points very close
together.  The BOSL2 offset function removes points, but it also has
the option to provide the map between original points and removed
points so that you can link the points together.  This is how
offset_sweep works.  There are two reasons I haven't pursued the
winding number scheme from the paper for a more robust offset.  One of
them is that it only works on polygons, not on paths with endpoints.
The other is that it won't give the mapping I need for offset_sweep,
and I use offset_sweep in almost every model.

The result of offset sweep on your shape with a radius 5 "dome"
appears below.  Note also that even if points are removed, all is not
lost.  You can link points "intelligently" and perhaps get a decent
result.  The BOSL2 skin() function does NOT require that the layers
linked together have the same number of points and if you use the
"distance" method you can perhaps get a good result on an example like
this, though it may be slow with many points, since the algorithm for
linking points is O(N^3).


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Your code for computing the polygon relied on something inside dependencies.scad that conflicted with BOSL2, so I just printed out the contents of that path to use with BOSL2. To create a domed shape based on an input pointlist: include<BOSL2/std.scad> include<BOSL2/rounding.scad> offset_sweep(pointlist, height=10, top=os_circle(r=5)); You need height to be larger than the radius given for the top, or you can omit height entirely and you'll just get the dome. The offset_sweep() function is pretty complicated, with lots of options. To learn how to use it, go here: https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > > Thanks very much for your answer > I will the bosl library and use the same for such applications. > Can you share the modified scad file > > On Mon, 10 Jan 2022, 01:15 Adrian Mariano, <avm4@cornell.edu> wrote: >> >> I think you will find that most offset strategies remove >> points---usually people are not interested in retaining extra points. >> When I talk about robustness I mean getting the right answer at all, >> not getting the right answer and tracking the point mapping between >> the original and offset curves. >> >> I do not know what the content of your dependencies.scad is, but I >> tried your example in BOSL2. In order to get a correct result with an >> offset of -5 I had to select quality=4. I think this is because you >> have excessively fine sampling, with lots of points very close >> together. The BOSL2 offset function removes points, but it also has >> the option to provide the map between original points and removed >> points so that you can link the points together. This is how >> offset_sweep works. There are two reasons I haven't pursued the >> winding number scheme from the paper for a more robust offset. One of >> them is that it only works on polygons, not on paths with endpoints. >> The other is that it won't give the mapping I need for offset_sweep, >> and I use offset_sweep in almost every model. >> >> The result of offset sweep on your shape with a radius 5 "dome" >> appears below. Note also that even if points are removed, all is not >> lost. You can link points "intelligently" and perhaps get a decent >> result. The BOSL2 skin() function does NOT require that the layers >> linked together have the same number of points and if you use the >> "distance" method you can perhaps get a good result on an example like >> this, though it may be slow with many points, since the algorithm for >> linking points is O(N^3). >> >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 11:34 PM

Thanks a lot for your help

On Mon, 10 Jan 2022, 05:00 Adrian Mariano, avm4@cornell.edu wrote:

Your code for computing the polygon relied on something inside
dependencies.scad that conflicted with BOSL2, so I just printed out
the contents of that path to use with BOSL2.  To create a domed shape
based on an input pointlist:

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>

offset_sweep(pointlist, height=10, top=os_circle(r=5));

You need height to be larger than the radius given for the top, or you
can omit height entirely and you'll just get the dome.  The
offset_sweep() function is pretty complicated, with lots of options.
To learn how to use it, go here:

https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep

On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks very much for your answer
I will the bosl library and use the same for such applications.
Can you share the modified scad file

On Mon, 10 Jan 2022, 01:15 Adrian Mariano, avm4@cornell.edu wrote:

I think you will find that most offset strategies remove
points---usually people are not interested in retaining extra points.
When I talk about robustness I mean getting the right answer at all,
not getting the right answer and tracking the point mapping between
the original and offset curves.

I do not know what the content of your dependencies.scad is, but I
tried your example in BOSL2.  In order to get a correct result with an
offset of -5 I had to select quality=4.  I think this is because you
have excessively fine sampling, with lots of points very close
together.  The BOSL2 offset function removes points, but it also has
the option to provide the map between original points and removed
points so that you can link the points together.  This is how
offset_sweep works.  There are two reasons I haven't pursued the
winding number scheme from the paper for a more robust offset.  One of
them is that it only works on polygons, not on paths with endpoints.
The other is that it won't give the mapping I need for offset_sweep,
and I use offset_sweep in almost every model.

The result of offset sweep on your shape with a radius 5 "dome"
appears below.  Note also that even if points are removed, all is not
lost.  You can link points "intelligently" and perhaps get a decent
result.  The BOSL2 skin() function does NOT require that the layers
linked together have the same number of points and if you use the
"distance" method you can perhaps get a good result on an example like
this, though it may be slow with many points, since the algorithm for
linking points is O(N^3).


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

Thanks a lot for your help On Mon, 10 Jan 2022, 05:00 Adrian Mariano, <avm4@cornell.edu> wrote: > Your code for computing the polygon relied on something inside > dependencies.scad that conflicted with BOSL2, so I just printed out > the contents of that path to use with BOSL2. To create a domed shape > based on an input pointlist: > > include<BOSL2/std.scad> > include<BOSL2/rounding.scad> > > offset_sweep(pointlist, height=10, top=os_circle(r=5)); > > You need height to be larger than the radius given for the top, or you > can omit height entirely and you'll just get the dome. The > offset_sweep() function is pretty complicated, with lots of options. > To learn how to use it, go here: > > > https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep > > On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar > <sprabhakar2006@gmail.com> wrote: > > > > Thanks very much for your answer > > I will the bosl library and use the same for such applications. > > Can you share the modified scad file > > > > On Mon, 10 Jan 2022, 01:15 Adrian Mariano, <avm4@cornell.edu> wrote: > >> > >> I think you will find that most offset strategies remove > >> points---usually people are not interested in retaining extra points. > >> When I talk about robustness I mean getting the right answer at all, > >> not getting the right answer and tracking the point mapping between > >> the original and offset curves. > >> > >> I do not know what the content of your dependencies.scad is, but I > >> tried your example in BOSL2. In order to get a correct result with an > >> offset of -5 I had to select quality=4. I think this is because you > >> have excessively fine sampling, with lots of points very close > >> together. The BOSL2 offset function removes points, but it also has > >> the option to provide the map between original points and removed > >> points so that you can link the points together. This is how > >> offset_sweep works. There are two reasons I haven't pursued the > >> winding number scheme from the paper for a more robust offset. One of > >> them is that it only works on polygons, not on paths with endpoints. > >> The other is that it won't give the mapping I need for offset_sweep, > >> and I use offset_sweep in almost every model. > >> > >> The result of offset sweep on your shape with a radius 5 "dome" > >> appears below. Note also that even if points are removed, all is not > >> lost. You can link points "intelligently" and perhaps get a decent > >> result. The BOSL2 skin() function does NOT require that the layers > >> linked together have the same number of points and if you use the > >> "distance" method you can perhaps get a good result on an example like > >> this, though it may be slow with many points, since the algorithm for > >> linking points is O(N^3). > >> > >> > > _______________________________________________ > > 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 >
SP
Sanjeev Prabhakar
Sun, Jan 16, 2022 2:50 AM

please see the attached scad file "example of heart".
Not able to figure out why so many warnings, but it renders ok.
Is there a way to suppress these warnings

On Mon, 10 Jan 2022 at 05:04, Sanjeev Prabhakar sprabhakar2006@gmail.com
wrote:

Thanks a lot for your help

On Mon, 10 Jan 2022, 05:00 Adrian Mariano, avm4@cornell.edu wrote:

Your code for computing the polygon relied on something inside
dependencies.scad that conflicted with BOSL2, so I just printed out
the contents of that path to use with BOSL2.  To create a domed shape
based on an input pointlist:

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>

offset_sweep(pointlist, height=10, top=os_circle(r=5));

You need height to be larger than the radius given for the top, or you
can omit height entirely and you'll just get the dome.  The
offset_sweep() function is pretty complicated, with lots of options.
To learn how to use it, go here:

https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep

On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

Thanks very much for your answer
I will the bosl library and use the same for such applications.
Can you share the modified scad file

On Mon, 10 Jan 2022, 01:15 Adrian Mariano, avm4@cornell.edu wrote:

I think you will find that most offset strategies remove
points---usually people are not interested in retaining extra points.
When I talk about robustness I mean getting the right answer at all,
not getting the right answer and tracking the point mapping between
the original and offset curves.

I do not know what the content of your dependencies.scad is, but I
tried your example in BOSL2.  In order to get a correct result with an
offset of -5 I had to select quality=4.  I think this is because you
have excessively fine sampling, with lots of points very close
together.  The BOSL2 offset function removes points, but it also has
the option to provide the map between original points and removed
points so that you can link the points together.  This is how
offset_sweep works.  There are two reasons I haven't pursued the
winding number scheme from the paper for a more robust offset.  One of
them is that it only works on polygons, not on paths with endpoints.
The other is that it won't give the mapping I need for offset_sweep,
and I use offset_sweep in almost every model.

The result of offset sweep on your shape with a radius 5 "dome"
appears below.  Note also that even if points are removed, all is not
lost.  You can link points "intelligently" and perhaps get a decent
result.  The BOSL2 skin() function does NOT require that the layers
linked together have the same number of points and if you use the
"distance" method you can perhaps get a good result on an example like
this, though it may be slow with many points, since the algorithm for
linking points is O(N^3).


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

please see the attached scad file "example of heart". Not able to figure out why so many warnings, but it renders ok. Is there a way to suppress these warnings On Mon, 10 Jan 2022 at 05:04, Sanjeev Prabhakar <sprabhakar2006@gmail.com> wrote: > Thanks a lot for your help > > On Mon, 10 Jan 2022, 05:00 Adrian Mariano, <avm4@cornell.edu> wrote: > >> Your code for computing the polygon relied on something inside >> dependencies.scad that conflicted with BOSL2, so I just printed out >> the contents of that path to use with BOSL2. To create a domed shape >> based on an input pointlist: >> >> include<BOSL2/std.scad> >> include<BOSL2/rounding.scad> >> >> offset_sweep(pointlist, height=10, top=os_circle(r=5)); >> >> You need height to be larger than the radius given for the top, or you >> can omit height entirely and you'll just get the dome. The >> offset_sweep() function is pretty complicated, with lots of options. >> To learn how to use it, go here: >> >> >> https://github.com/revarbat/BOSL2/wiki/rounding.scad#functionmodule-offset_sweep >> >> On Sun, Jan 9, 2022 at 6:01 PM Sanjeev Prabhakar >> <sprabhakar2006@gmail.com> wrote: >> > >> > Thanks very much for your answer >> > I will the bosl library and use the same for such applications. >> > Can you share the modified scad file >> > >> > On Mon, 10 Jan 2022, 01:15 Adrian Mariano, <avm4@cornell.edu> wrote: >> >> >> >> I think you will find that most offset strategies remove >> >> points---usually people are not interested in retaining extra points. >> >> When I talk about robustness I mean getting the right answer at all, >> >> not getting the right answer and tracking the point mapping between >> >> the original and offset curves. >> >> >> >> I do not know what the content of your dependencies.scad is, but I >> >> tried your example in BOSL2. In order to get a correct result with an >> >> offset of -5 I had to select quality=4. I think this is because you >> >> have excessively fine sampling, with lots of points very close >> >> together. The BOSL2 offset function removes points, but it also has >> >> the option to provide the map between original points and removed >> >> points so that you can link the points together. This is how >> >> offset_sweep works. There are two reasons I haven't pursued the >> >> winding number scheme from the paper for a more robust offset. One of >> >> them is that it only works on polygons, not on paths with endpoints. >> >> The other is that it won't give the mapping I need for offset_sweep, >> >> and I use offset_sweep in almost every model. >> >> >> >> The result of offset sweep on your shape with a radius 5 "dome" >> >> appears below. Note also that even if points are removed, all is not >> >> lost. You can link points "intelligently" and perhaps get a decent >> >> result. The BOSL2 skin() function does NOT require that the layers >> >> linked together have the same number of points and if you use the >> >> "distance" method you can perhaps get a good result on an example like >> >> this, though it may be slow with many points, since the algorithm for >> >> linking points is O(N^3). >> >> >> >> >> > _______________________________________________ >> > 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 >> >