discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

method to sweep or skin a hollow object without difference function

JJ
Johan Jonker
Thu, Dec 22, 2016 5:20 PM

Method number 6:

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19697.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Method number 6: -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19697.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JJ
Johan Jonker
Thu, Dec 22, 2016 5:35 PM

@parkinbot
Since I often make designs for wind instruments most of my designs are
hollow solids. I still do not understand well how to prevent all errors like
non manifold and non planar. Most of them happen when I use the difference
function.
So I like to have alternatives for that and also nice examples as some kind
of memory.
I think your rules give important information for me to prevent problems,
but I do not understand it 100%.
Ad. 0) Self-intersection is in the figure below? But what is mutually
intersect?
And I think I know the rule but so be honest I do not really understand what
goes wrong then
Ad. 1) A defined orientation. I think I understand that. But when does it
go wrong? Can you give an example.
Ad. 2) I don't know what coplanar is
Ad. 3) Ronaldo gave a good example in another item.
Ad. 4) I don't understand what this means.
http://forum.openscad.org/file/n19698/intersection.jpg

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19698.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

@parkinbot Since I often make designs for wind instruments most of my designs are hollow solids. I still do not understand well how to prevent all errors like non manifold and non planar. Most of them happen when I use the difference function. So I like to have alternatives for that and also nice examples as some kind of memory. I think your rules give important information for me to prevent problems, but I do not understand it 100%. Ad. 0) Self-intersection is in the figure below? But what is mutually intersect? And I think I know the rule but so be honest I do not really understand what goes wrong then Ad. 1) A defined orientation. I think I understand that. But when does it go wrong? Can you give an example. Ad. 2) I don't know what coplanar is Ad. 3) Ronaldo gave a good example in another item. Ad. 4) I don't understand what this means. <http://forum.openscad.org/file/n19698/intersection.jpg> -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19698.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Thu, Dec 22, 2016 6:33 PM

Coplanar means that they are in the same plane. This condition is redundant:
if a connected set of facets are in the same plane and exactly two meet at
each edge, there will be almost two non-disjoint facets in the set.
Or, in other terms, if you project the facets of a 2-manifold without border
in a plane, at least two projected facets will have a 2D intersection
(meaning with a non zero area). So, this conditions is covered by the first.

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19699.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Coplanar means that they are in the same plane. This condition is redundant: if a connected set of facets are in the same plane and exactly two meet at each edge, there will be almost two non-disjoint facets in the set. Or, in other terms, if you project the facets of a 2-manifold without border in a plane, at least two projected facets will have a 2D intersection (meaning with a non zero area). So, this conditions is covered by the first. -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19699.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Thu, Dec 22, 2016 9:51 PM

Johan Jonker wrote

Most of them happen when I use the difference function.
<br>

They for sure "happen" somewhere else, but it is the boolean operations, who
indicate them, as they are executed through CGAL.

See my last post. You can use my sweep() - and also skin(), I guess - with
your initial code. That means:
You choose a trajectory that starts e.g. at the bottom and outer circle,
goes up along the outer skin, jumps at the "end" to the inner circle and
goes the way back to the start where it will be finally connected. In other
words, you define a looped trajectory for each point in the polygon you
start with.

As looped trajectories seem to be viable for you, you don't have to
understand or implement the procedure I proposed, which uses a sequence of
paired polygons describing the inner and outer surface skeleton. Both
approaches are equivalent!

But nevertheless here are some answers:

ad 0. imagine two circles with different radi. They are both not self
intersecting, but they can insect at one or two points. Avoid also this!
ad 1 you have to decide for either CW or CCW polygons when you setup a
connection scheme. Otherwise you can end up with inside-out solids. Of
course you could use tests, but this costs time and code.
ad 2 when you start in 2D, all points are in one plane and thus coplanar. To
ensure they stay coplanar you can use the same affine transformation. In
most (= non pathologic) cases this will guarantee you that they will not
intersect in 3D.
ad 4 think about describing the area between two circles with different
radii, but identical center. Say, you use two polygons to describe the
circles, each containing N points. For the faces list it is best to use
quads or triangles. Look at the following code, which uses quads. It will
only work properly, if the points in the two polygons are arranged in a
beneficial way. This is what I meant.

N = 10;
points = concat(circ(100, N), circ(90, N));
polyhedron(points, face(N));
function circ(r, N) = [for (i=[0:N-1]) let (a =360/N*i) [r * cos(a), r *
sin(a), 0] ];
function face(N) =  [for (i=[0:N-1]) [i,  (i+1)%N, (i+1)%N+N, i+N]];

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19700.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Johan Jonker wrote > Most of them happen when I use the difference function. > <br> They for sure "happen" somewhere else, but it is the boolean operations, who indicate them, as they are executed through CGAL. See my last post. You can use my sweep() - and also skin(), I guess - with your initial code. That means: You choose a trajectory that starts e.g. at the bottom and outer circle, goes up along the outer skin, jumps at the "end" to the inner circle and goes the way back to the start where it will be finally connected. In other words, you define a looped trajectory for each point in the polygon you start with. As looped trajectories seem to be viable for you, you don't have to understand or implement the procedure I proposed, which uses a sequence of paired polygons describing the inner and outer surface skeleton. Both approaches are equivalent! But nevertheless here are some answers: ad 0. imagine two circles with different radi. They are both not self intersecting, but they can insect at one or two points. Avoid also this! ad 1 you have to decide for either CW or CCW polygons when you setup a connection scheme. Otherwise you can end up with inside-out solids. Of course you could use tests, but this costs time and code. ad 2 when you start in 2D, all points are in one plane and thus coplanar. To ensure they stay coplanar you can use the same affine transformation. In most (= non pathologic) cases this will guarantee you that they will not intersect in 3D. ad 4 think about describing the area between two circles with different radii, but identical center. Say, you use two polygons to describe the circles, each containing N points. For the faces list it is best to use quads or triangles. Look at the following code, which uses quads. It will only work properly, if the points in the two polygons are arranged in a beneficial way. This is what I meant. > N = 10; > points = concat(circ(100, N), circ(90, N)); > polyhedron(points, face(N)); > function circ(r, N) = [for (i=[0:N-1]) let (a =360/N*i) [r * cos(a), r * > sin(a), 0] ]; > function face(N) = [for (i=[0:N-1]) [i, (i+1)%N, (i+1)%N+N, i+N]]; -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19700.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jon
Fri, Dec 23, 2016 1:10 PM

Parkinbot: when you said "my newest" I realized that I do not have any
way to know when you post updates.  Any hints on the best way to stay
current?

On 12/22/2016 11:36 AM, Parkinbot wrote:

Johan, btw. your first code seemlessly works with my newest version of
Naca_sweep.scad which meanwhile also supports closed extrusions. I uploaded
it for you. Get it at: http://www.thingiverse.com/thing:900137

To use the new feature just alter the sweep() call into:

sweep(objcup, close = true);

Parkinbot: when you said "my newest" I realized that I do not have any way to know when you post updates. Any hints on the best way to stay current? On 12/22/2016 11:36 AM, Parkinbot wrote: > Johan, btw. your first code seemlessly works with my newest version of > Naca_sweep.scad which meanwhile also supports closed extrusions. I uploaded > it for you. Get it at: http://www.thingiverse.com/thing:900137 > > To use the new feature just alter the sweep() call into: > > >> sweep(objcup, close = true); >
P
Parkinbot
Fri, Dec 23, 2016 6:25 PM

Jon, just stay tuned to this forum.

Only after having read Johan's initial code more seriously, I realized that
my last private update would do the job. So I published it, since Johan is
the only one I know, who is seriously (and in many times also desperately)
using my libs in his workflows.

Usually I don't publish new features with old projects, because there is
always a chance to unwillingly break peoples code. Also I would feel that I
have to document the new stuff and give examples on how to use it. That
takes much time and keeps me away from my own current projects. While the
/close=true/ option opens my primitive /sweep()/ for toric topology (= the
class of manifolds with one hole) my /nSpline()/ does not yet support this
topology, and going into that lib again is a very nasty job. When I need it
myself one day, I'll code it, but not just for completeness.

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19710.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Jon, just stay tuned to this forum. Only after having read Johan's initial code more seriously, I realized that my last private update would do the job. So I published it, since Johan is the only one I know, who is seriously (and in many times also desperately) using my libs in his workflows. Usually I don't publish new features with old projects, because there is always a chance to unwillingly break peoples code. Also I would feel that I have to document the new stuff and give examples on how to use it. That takes much time and keeps me away from my own current projects. While the /close=true/ option opens my primitive /sweep()/ for toric topology (= the class of manifolds with one hole) my /nSpline()/ does not yet support this topology, and going into that lib again is a very nasty job. When I need it myself one day, I'll code it, but not just for completeness. -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19710.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Fri, Dec 23, 2016 7:20 PM

Jon and Parkinbot,

I have an implementation of a spline interpolant that is more general than
the one in splines.scad. For instance, it includes many end conditions and
also periodic splines, that is, interpolation splines for closed loops. I
have just tested it with the knot() module of splines.scad and it worked as
a charm. If that is what is missing, I can provide the code.

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19711.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Jon and Parkinbot, I have an implementation of a spline interpolant that is more general than the one in splines.scad. For instance, it includes many end conditions and also periodic splines, that is, interpolation splines for closed loops. I have just tested it with the knot() module of splines.scad and it worked as a charm. If that is what is missing, I can provide the code. -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19711.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Fri, Dec 23, 2016 7:34 PM

Ronaldo,

as I wrote, when I need it, I'll extend my code. (For me it saves much time,
to use my own code.)
But it would be nice of course, if you published and documented your code
together with some examples. Thingiverse is a good platform for things like
that.

--
View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19712.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo, as I wrote, when I need it, I'll extend my code. (For me it saves much time, to use my own code.) But it would be nice of course, if you published and documented your code together with some examples. Thingiverse is a good platform for things like that. -- View this message in context: http://forum.openscad.org/method-to-sweep-or-skin-a-hollow-object-without-difference-function-tp19677p19712.html Sent from the OpenSCAD mailing list archive at Nabble.com.