Odd shapes with domes

SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 6:41 AM

dotscad also fails in many cases.

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.

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

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
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:

dotscad also fails in many cases.

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.

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

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

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:

dotscad also fails in many cases.

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.

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

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

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

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

AM
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

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:

dotscad also fails in many cases.

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.

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

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

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

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

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

SP
Sanjeev Prabhakar
Sun, Jan 9, 2022 11:01 PM

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

AM
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:

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:

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

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

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:

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:

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

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

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

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

SP
Sanjeev Prabhakar
Sun, Jan 16, 2022 2:50 AM

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:

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:

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

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