discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Polygons With Paths Touching Edges

NS
Nathan Sokalski
Wed, Feb 19, 2025 8:50 PM

As most of us know, the boolean functions (difference, intersection, etc.) should be used sparingly due to the extra time they use during processing. It is also known that it is good practice to make the elements involved should be made slightly larger to avoid edges touching edges (for example, increasing the height of a cylinder when making a hole with difference). I have a polygon from which I want to remove several areas that touch the edges. The reason I am using paths instead of modifying the perimeter is because the area being removed actually touches opposite edges, basically splitting the polygon into multiple pieces. The two solutions I have come up with are:

Use difference(), but as mentioned earlier, this should be used sparingly
2.
Create multiple polygons that do not require me to create extra paths to subtract

Is there a way to avoid this problem? I am wondering if this is possible because paths are specific to polygon, along with the fact that they are 2d instead of 3d.

Nathan Sokalski
njsokalski@hotmail.commailto:njsokalski@hotmail.com

As most of us know, the boolean functions (difference, intersection, etc.) should be used sparingly due to the extra time they use during processing. It is also known that it is good practice to make the elements involved should be made slightly larger to avoid edges touching edges (for example, increasing the height of a cylinder when making a hole with difference). I have a polygon from which I want to remove several areas that touch the edges. The reason I am using paths instead of modifying the perimeter is because the area being removed actually touches opposite edges, basically splitting the polygon into multiple pieces. The two solutions I have come up with are: 1. Use difference(), but as mentioned earlier, this should be used sparingly 2. Create multiple polygons that do not require me to create extra paths to subtract Is there a way to avoid this problem? I am wondering if this is possible because paths are specific to polygon, along with the fact that they are 2d instead of 3d. Nathan Sokalski njsokalski@hotmail.com<mailto:njsokalski@hotmail.com>
AM
Adrian Mariano
Wed, Feb 19, 2025 9:02 PM

It is somewhat unclear but it sounds like you are using BOSL2 and referring
to the functions it supports for operation on paths.  I suggest that your
problem statement is too generic and vague for anybody to comment
usefully.  If difference() is fast enough and produces a good result, why
not use that?  Beyond that, much depends on how you make your paths and
what exactly you're trying to cut off of them.  Perhaps the half_of()
function would help?

On Wed, Feb 19, 2025 at 3:51 PM Nathan Sokalski via Discuss <
discuss@lists.openscad.org> wrote:

As most of us know, the boolean functions (difference, intersection, etc.)
should be used sparingly due to the extra time they use during processing.
It is also known that it is good practice to make the elements involved
should be made slightly larger to avoid edges touching edges (for example,
increasing the height of a cylinder when making a hole with difference). I
have a polygon from which I want to remove several areas that touch the
edges. The reason I am using paths instead of modifying the perimeter is
because the area being removed actually touches opposite edges, basically
splitting the polygon into multiple pieces. The two solutions I have come
up with are:

1. Use difference(), but as mentioned earlier, this should be used
sparingly
2. Create multiple polygons that do not require me to create extra
paths to subtract

Is there a way to avoid this problem? I am wondering if this is possible
because paths are specific to polygon, along with the fact that they are 2d
instead of 3d.

Nathan Sokalski
njsokalski@hotmail.com


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

It is somewhat unclear but it sounds like you are using BOSL2 and referring to the functions it supports for operation on paths. I suggest that your problem statement is too generic and vague for anybody to comment usefully. If difference() is fast enough and produces a good result, why not use that? Beyond that, much depends on how you make your paths and what exactly you're trying to cut off of them. Perhaps the half_of() function would help? On Wed, Feb 19, 2025 at 3:51 PM Nathan Sokalski via Discuss < discuss@lists.openscad.org> wrote: > As most of us know, the boolean functions (difference, intersection, etc.) > should be used sparingly due to the extra time they use during processing. > It is also known that it is good practice to make the elements involved > should be made slightly larger to avoid edges touching edges (for example, > increasing the height of a cylinder when making a hole with difference). I > have a polygon from which I want to remove several areas that touch the > edges. The reason I am using paths instead of modifying the perimeter is > because the area being removed actually touches opposite edges, basically > splitting the polygon into multiple pieces. The two solutions I have come > up with are: > > > 1. Use difference(), but as mentioned earlier, this should be used > sparingly > 2. Create multiple polygons that do not require me to create extra > paths to subtract > > Is there a way to avoid this problem? I am wondering if this is possible > because paths are specific to polygon, along with the fact that they are 2d > instead of 3d. > > Nathan Sokalski > njsokalski@hotmail.com > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JB
Jordan Brown
Thu, Feb 20, 2025 12:23 AM

It's important to know that the 2D boolean functions are a great deal
faster than their 3D equivalents.  I wouldn't worry about performance
with them at all.

And even the 3D functions aren't that bad.  They weren't that bad
with CGAL, and they are much faster with Manifold.  Yes, they take time,
but I suspect no more than a union does - and if they're what your
project needs, it's better to have your project be clearer and easier to
understand than to minimize its render time.

Mostly, don't worry about performance until it's a problem.  It isn't
quite true that "premature optimization is the root of all evil", but
especially in the 3D printing world the tradeoffs can be inverted from
traditional software development.  How many times are you going to
render your project?  It depends on the project, of course, but mostly
it's going to be a lot of previews during development, and then a
handful of actual renders to make and tune the production STL... and
then zero.  It's not something that a user is going to do every day. 
Again, there are exceptions, but I think this is true for most projects.

By all means adopt patterns that improve performance, where they don't
conflict with understandability.  If you're going to make a block with a
bunch of vertical holes in it, do everything in 2D and then extrude into
3D, because that's a lot faster than doing it in 3D in the first place -
and, critical, it's not any less understandable.  But if you are
hand-building a polyhedron with a hole in it, to avoid a difference, I
think you're making the wrong tradeoff.

It's important to know that the 2D boolean functions are a great deal faster than their 3D equivalents.  I wouldn't worry about performance with them at all. And even the 3D functions aren't *that* bad.  They weren't *that* bad with CGAL, and they are much faster with Manifold.  Yes, they take time, but I suspect no more than a union does - and if they're what your project needs, it's better to have your project be clearer and easier to understand than to minimize its render time. Mostly, don't worry about performance until it's a problem.  It isn't quite true that "premature optimization is the root of all evil", but especially in the 3D printing world the tradeoffs can be inverted from traditional software development.  How many times are you going to render your project?  It depends on the project, of course, but mostly it's going to be a lot of previews during development, and then a handful of actual renders to make and tune the production STL... and then zero.  It's *not* something that a user is going to do every day.  Again, there are exceptions, but I think this is true for most projects. By all means adopt patterns that improve performance, where they don't conflict with understandability.  If you're going to make a block with a bunch of vertical holes in it, do everything in 2D and then extrude into 3D, because that's a lot faster than doing it in 3D in the first place - and, critical, it's not any less understandable.  But if you are hand-building a polyhedron with a hole in it, to avoid a difference, I think you're making the wrong tradeoff.
SP
Sanjeev Prabhakar
Thu, Feb 20, 2025 12:42 AM

I use difference,  intersection and union quite often and don't find any
issue using them.

While using difference you need to make sure that if you press f12, the
object should not turn magenta. That means the normals are flipped.

In such case, you need to flip the normals and that can be easily done by
reversing the sequence of points ( in case you are making your model by
defining points instead of using primitives).

On Thu, 20 Feb, 2025, 2:21 am Nathan Sokalski via Discuss, <
discuss@lists.openscad.org> wrote:

As most of us know, the boolean functions (difference, intersection, etc.)
should be used sparingly due to the extra time they use during processing.
It is also known that it is good practice to make the elements involved
should be made slightly larger to avoid edges touching edges (for example,
increasing the height of a cylinder when making a hole with difference). I
have a polygon from which I want to remove several areas that touch the
edges. The reason I am using paths instead of modifying the perimeter is
because the area being removed actually touches opposite edges, basically
splitting the polygon into multiple pieces. The two solutions I have come
up with are:

1. Use difference(), but as mentioned earlier, this should be used
sparingly
2. Create multiple polygons that do not require me to create extra
paths to subtract

Is there a way to avoid this problem? I am wondering if this is possible
because paths are specific to polygon, along with the fact that they are 2d
instead of 3d.

Nathan Sokalski
njsokalski@hotmail.com


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

I use difference, intersection and union quite often and don't find any issue using them. While using difference you need to make sure that if you press f12, the object should not turn magenta. That means the normals are flipped. In such case, you need to flip the normals and that can be easily done by reversing the sequence of points ( in case you are making your model by defining points instead of using primitives). On Thu, 20 Feb, 2025, 2:21 am Nathan Sokalski via Discuss, < discuss@lists.openscad.org> wrote: > As most of us know, the boolean functions (difference, intersection, etc.) > should be used sparingly due to the extra time they use during processing. > It is also known that it is good practice to make the elements involved > should be made slightly larger to avoid edges touching edges (for example, > increasing the height of a cylinder when making a hole with difference). I > have a polygon from which I want to remove several areas that touch the > edges. The reason I am using paths instead of modifying the perimeter is > because the area being removed actually touches opposite edges, basically > splitting the polygon into multiple pieces. The two solutions I have come > up with are: > > > 1. Use difference(), but as mentioned earlier, this should be used > sparingly > 2. Create multiple polygons that do not require me to create extra > paths to subtract > > Is there a way to avoid this problem? I am wondering if this is possible > because paths are specific to polygon, along with the fact that they are 2d > instead of 3d. > > Nathan Sokalski > njsokalski@hotmail.com > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >