discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Can you sweep a object with fingers

R
Ronaldo
Fri, Nov 18, 2016 10:16 PM

Parkinbot wrote

But back to your approach. I have the impression that it might be a good
idea to connect the simpler sweep() approach with your stuff: Using
sweep() with all its restrictions and advantages (planar polgons, easy
transformations, description, and meshing) for the G0/G1 parts of a
design, and to model just the transition zones, where furcations actually
happen, with your pathwork design. In this case, your generator's input
could be one or more (consecutive) planar polygons, already transformed
into 3D, for each branch. The first polygon defines the border (meeting
zone) with all its vertices, the others slopes (also of higher order) -
all polygons together form your boundary condition, that can be
transferred into Bezier parameters. The desired output would be the e.g.
C2 continued mesh. You can view this as an isolated problem, since it is
perfectly allowed to union polyhedra (even it is slow right now).
I have sketched this approach once in
an other thread
http://forum.openscad.org/Rendering-fails-difference-between-F5-and-F6-tp15041p15182.html
, but never found time (and enough reason) to go deeper into the sloppy
modelling of the transition zone.

I think I missed the discussion you have referred: I have never seen before
the image of your furcation. Very clever illustration.

To integrate sweep/skin in my approach was already in my plans. If you look
at my version of Linde's sweep code, you will see that the computation of
vertices and faces of the sweep is done by a function that outputs the pair
[ <vertex list>, <face list> ] good enough to send to a polyhedron, what is
done by a separate module. Besides, I sketched loft functions to connect two
closed arcs that works even when they have different len(). It is a kind of
C1 or C2 sweep (like the one I have shown in my last image). In another
experiment I had generalized the skin to smoothly wrap a sequence of 2D
closed arcs. Everything done with spline interpolation.

So, I have the most basic tools to make "tubes". Now I am facing the hard
part: to model furcations. One of the problems is how to easily specify the
topology so that a suitable geometry could be created. I see two possible
specification approaches: define the geometry of the nodes or connectors and
then how to connect them by tubes; or, define the geometry of the tubes
(sweeps) and then the topology of the nodes or connectors. Either way, I
need ways of define hexagonal (or octogonal, etc) smooth surfaces. And for
that the triangular Bezier patches will be handy.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19227.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parkinbot wrote > But back to your approach. I have the impression that it might be a good > idea to connect the simpler sweep() approach with your stuff: Using > sweep() with all its restrictions and advantages (planar polgons, easy > transformations, description, and meshing) for the G0/G1 parts of a > design, and to model just the transition zones, where furcations actually > happen, with your pathwork design. In this case, your generator's input > could be one or more (consecutive) planar polygons, already transformed > into 3D, for each branch. The first polygon defines the border (meeting > zone) with all its vertices, the others slopes (also of higher order) - > all polygons together form your boundary condition, that can be > transferred into Bezier parameters. The desired output would be the e.g. > C2 continued mesh. You can view this as an isolated problem, since it is > perfectly allowed to union polyhedra (even it is slow right now). > I have sketched this approach once in > an other thread > <http://forum.openscad.org/Rendering-fails-difference-between-F5-and-F6-tp15041p15182.html> > , but never found time (and enough reason) to go deeper into the sloppy > modelling of the transition zone. I think I missed the discussion you have referred: I have never seen before the image of your furcation. Very clever illustration. To integrate sweep/skin in my approach was already in my plans. If you look at my version of Linde's sweep code, you will see that the computation of vertices and faces of the sweep is done by a function that outputs the pair [ <vertex list>, <face list> ] good enough to send to a polyhedron, what is done by a separate module. Besides, I sketched loft functions to connect two closed arcs that works even when they have different len(). It is a kind of C1 or C2 sweep (like the one I have shown in my last image). In another experiment I had generalized the skin to smoothly wrap a sequence of 2D closed arcs. Everything done with spline interpolation. So, I have the most basic tools to make "tubes". Now I am facing the hard part: to model furcations. One of the problems is how to easily specify the topology so that a suitable geometry could be created. I see two possible specification approaches: define the geometry of the nodes or connectors and then how to connect them by tubes; or, define the geometry of the tubes (sweeps) and then the topology of the nodes or connectors. Either way, I need ways of define hexagonal (or octogonal, etc) smooth surfaces. And for that the triangular Bezier patches will be handy. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19227.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Fri, Nov 18, 2016 11:28 PM

Ronaldo wrote

One of the problems is how to easily specify the topology so that a
suitable geometry could be created.

Here we are. Find a maximal information reduced representation capable to
describe everything you want in a intuitive way. Feed your magic with e.g.
some small matrix and let it create a whole world.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19230.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > One of the problems is how to easily specify the topology so that a > suitable geometry could be created. Here we are. Find a maximal information reduced representation capable to describe everything you want in a intuitive way. Feed your magic with e.g. some small matrix and let it create a whole world. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19230.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Fri, Nov 18, 2016 11:59 PM

Aha! Now it's easy. :)

2016-11-18 21:28 GMT-02:00 Parkinbot rudolf@parkinbot.com:

Ronaldo wrote

One of the problems is how to easily specify the topology so that a
suitable geometry could be created.

Here we are. Find a maximal information reduced representation capable to
describe everything you want in a intuitive way. Feed your magic with e.g.
some small matrix and let it create a whole world.

Aha! Now it's easy. :) 2016-11-18 21:28 GMT-02:00 Parkinbot <rudolf@parkinbot.com>: > Ronaldo wrote > > One of the problems is how to easily specify the topology so that a > > suitable geometry could be created. > > Here we are. Find a maximal information reduced representation capable to > describe everything you want in a intuitive way. Feed your magic with e.g. > some small matrix and let it create a whole world. >
R
runsun
Sat, Nov 19, 2016 12:52 AM

Ronaldo wrote

The only data to build this model were the 24 blue-marked points and some
few floats that control the shape of the lofts. The first plane model, for
instance, used the same definitions of the middle one except for the
higher "scales" of the tangents at the caps border. To build this kind of
model you don't need to understand fully Bezier curves and surface theory.

@ Ronaldo, trying to understand your approach here. Since there are only 24
points of data, which defines the 2nd and the 4th sections, how was the 3rd
section (the middle one) generated ?


$  Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 );   $ tips: hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )

View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19234.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > The only data to build this model were the 24 blue-marked points and some > few floats that control the shape of the lofts. The first plane model, for > instance, used the same definitions of the middle one except for the > higher "scales" of the tangents at the caps border. To build this kind of > model you don't need to understand fully Bezier curves and surface theory. @ Ronaldo, trying to understand your approach here. Since there are only 24 points of data, which defines the 2nd and the 4th sections, how was the 3rd section (the middle one) generated ? ----- $ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); &nbsp; $ tips: hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ) -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19234.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Sat, Nov 19, 2016 12:56 AM

@ Ronaldo, another question: the make_polyhedron. When you connect multiple
polyhedral, do they have to have the same # of points on both of the
connecting surfaces ?


$  Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 );   $ tips: hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )

View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19236.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

@ Ronaldo, another question: the make_polyhedron. When you connect multiple polyhedral, do they have to have the same # of points on both of the connecting surfaces ? ----- $ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); &nbsp; $ tips: hash ( 2 ), matrix ( 2 , 3 ), sweep ( 2 , 3 ), var ( 2 ), lerp , animation ( gif , prodVid , animlib ), precision ( 2 ), xl-control , type , rounded polygon , chfont , tailRecur ( 2, 3 ), isosphere ( 2 ), area , vol/center , RGB , CurvedImg , tests ( 2 ), text ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf ) -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19236.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Sat, Nov 19, 2016 12:22 PM

Another good approach would be to finally implement the DoWhatImean()
function.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19244.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Another good approach would be to finally implement the *DoWhatImean()* function. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19244.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sat, Nov 19, 2016 2:11 PM

runsun wrote

@ Ronaldo, another question: the make_polyhedron. When you connect
multiple polyhedral, do they have to have the same # of points on both of
the connecting surfaces ?

Good question. They must have the same points with the same coordinates. If
one of them has a sequence of points along the border edge of the other, it
doesn't work (possibly because of numerical differences).

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19245.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

runsun wrote > @ Ronaldo, another question: the make_polyhedron. When you connect > multiple polyhedral, do they have to have the same # of points on both of > the connecting surfaces ? Good question. They must have the same points with the same coordinates. If one of them has a sequence of points along the border edge of the other, it doesn't work (possibly because of numerical differences). -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19245.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sat, Nov 19, 2016 2:33 PM

runsun wrote

@ Ronaldo, trying to understand your approach here. Since there are only
24 points of data, which defines the 2nd and the 4th sections, how was the
3rd section (the middle one) generated ?

It is simpler than it sounds. I apply a loft function that interpolates
(position and derivatives) the border of the 2nd surface and the border of
the 4th. This function operates on the meshes and compute discrete
derivatives of the meshes. If I have the value and derivative in two points
I may apply Hermite interpolation. That is what is done at each pair of
points from border 1 and border 2.

// loft to surfaces with continuity G1
// requires that the borders to be lofted have same refinement
// h1 and h2 are derivative scales
function _loftSurfacesG1(s1,s2,h1=1,h2=1) =
len(s1[0]) == len(s2[0]) ?
let( n  = $rnu, n1 = len(s1), n2 = len(s2),
c1 = concat(s1[n1-1], cl1 ? [s1[n1-1][0]]: []), // edge curve
of s1
b1 = concat(s1[n1-2], cl1 ? [s1[n1-2][0]]: []), // near edge
curve of s1
c2 = concat(s2[0], cl2 ? [s2[0][0]] : []),// edge curve of s2
b2 = concat(s2[1], cl2 ? [s2[1][0]] : []), // near edge curve
of s2
d1 = h1*(c1-b1)n1, // derivative at edge of s1
d2 = h2
(b2-c2)*n2, // derivative at edge of s2
s  = concat([c1],_H1_2B(c1, c2, d1, d2)) )
Bezier_curve(s,$rn=n) :
["incompatible surface borders"];

In the code, _H1_2B is a conversion from Hermite data to Bezier degree 3
data.

Things are a bit harder if the two meshes to interpolate have distinct
number of border points. Some regularization is needed. So, the two mesh
borders are re-sampled accordingly.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19246.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

runsun wrote > @ Ronaldo, trying to understand your approach here. Since there are only > 24 points of data, which defines the 2nd and the 4th sections, how was the > 3rd section (the middle one) generated ? It is simpler than it sounds. I apply a loft function that interpolates (position and derivatives) the border of the 2nd surface and the border of the 4th. This function operates on the meshes and compute discrete derivatives of the meshes. If I have the value and derivative in two points I may apply Hermite interpolation. That is what is done at each pair of points from border 1 and border 2. > // loft to surfaces with continuity G1 > // requires that the borders to be lofted have same refinement > // h1 and h2 are derivative scales > function _loftSurfacesG1(s1,s2,h1=1,h2=1) = > len(s1[0]) == len(s2[0]) ? > let( n = $rnu, n1 = len(s1), n2 = len(s2), > c1 = concat(s1[n1-1], cl1 ? [s1[n1-1][0]]: []), // edge curve > of s1 > b1 = concat(s1[n1-2], cl1 ? [s1[n1-2][0]]: []), // near edge > curve of s1 > c2 = concat(s2[0], cl2 ? [s2[0][0]] : []),// edge curve of s2 > b2 = concat(s2[1], cl2 ? [s2[1][0]] : []), // near edge curve > of s2 > d1 = h1*(c1-b1)*n1, // derivative at edge of s1 > d2 = h2*(b2-c2)*n2, // derivative at edge of s2 > s = concat([c1],_H1_2B(c1, c2, d1, d2)) ) > Bezier_curve(s,$rn=n) : > ["incompatible surface borders"]; In the code, _H1_2B is a conversion from Hermite data to Bezier degree 3 data. Things are a bit harder if the two meshes to interpolate have distinct number of border points. Some regularization is needed. So, the two mesh borders are re-sampled accordingly. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19246.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sat, Nov 19, 2016 2:47 PM

Ronaldo wrote

runsun wrote

@ Ronaldo, another question: the make_polyhedron. When you connect
multiple polyhedral, do they have to have the same # of points on both of
the connecting surfaces ?

Good question. They must have the same points with the same coordinates.

If one of them has a sequence of points along the border edge of the
other, it doesn't work (possibly because of numerical differences).

That is not right. I have to investigate it a little more. The following
image shows the re-sampling I did in lofting two differently refined
surfaces.

http://forum.openscad.org/file/n19247/Resampling.png

The re-sampling process takes some points inside the border edge of the
meshes to loft. And the polyhedron joining them is a manifold.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19247.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > > runsun wrote >> @ Ronaldo, another question: the make_polyhedron. When you connect >> multiple polyhedral, do they have to have the same # of points on both of >> the connecting surfaces ? > Good question. They must have the same points with the same coordinates. * > If one of them has a sequence of points along the border edge of the > other, it doesn't work (possibly because of numerical differences). * That is not right. I have to investigate it a little more. The following image shows the re-sampling I did in lofting two differently refined surfaces. <http://forum.openscad.org/file/n19247/Resampling.png> The re-sampling process takes some points inside the border edge of the meshes to loft. And the polyhedron joining them is a manifold. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19247.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sat, Nov 19, 2016 7:55 PM

Ronaldo wrote

Ronaldo wrote

runsun wrote

@ Ronaldo, another question: the make_polyhedron. When you connect
multiple polyhedral, do they have to have the same # of points on both
of the connecting surfaces ?

Good question. They must have the same points with the same coordinates.

If one of them has a sequence of points along the border edge of the
other, it doesn't work (possibly because of numerical differences).

That is not right. I have to investigate it a little more. The following
image shows the re-sampling I did in lofting two differently refined
surfaces.

Well, I have rechecked this. It seems that the vertices of meeting parts
should be *exactly *the same. Try this code with show edges:

// tetrahedron with a missin face
p = [ [0,0,0], [10,0,0], [0,10,0], [0,0,10] ];
f = [ [0,1,2], [0,3,1], [0,2,3] ];
// additional faces to close it
n=3;
degface = false;
ps = [for(i=[0:n+1])  p[1]i/(n+1) + p[2](n+1-i)/(n+1) ];
fs = [for(i=[1:n+1]) [ 3, 3+i, 4+i ] ];
df = n>0 && degface ? [for(i=[n+2:-1:1]) 3+i ] : [];
// the full tetrahedron
difference(){
polyhedron(concat(p,ps),concat(f,fs,[df]));
cube(3,center=true);
translate([10,0,0]) cube(3,center=true);
}

Forget df for while. It is an empty list.

When n=0, ps will have 2 points equal to some points of list p and fs will
be the missing face. The difference will be a manifold. The render is fine.

When n>0, the missing face is subdivided in n parts. ps will have n+2 points
and fs will have n+1 faces whose union is the missing face. The difference
is no more a manifold, the render generates a warning and doesn't displays
some of the difference faces.

Now, a revealing trick: when degface=true, df is a degenerated face, all
vertices on a line. If this face is included in the polyhedron face list,
all gets right, CGAL builds a manifold from the polyhedron. This suggests
that CGAL expects a correct topological specification from polyhedron even
if some faces are degenerated. I think the same kind of consistence should
be expected in STL files.

I had not tested with F6 my last loft model. It doesn't work either. I will
have to review my loft for this case creating a transition.

--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19251.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > > Ronaldo wrote >> >> runsun wrote >>> @ Ronaldo, another question: the make_polyhedron. When you connect >>> multiple polyhedral, do they have to have the same # of points on both >>> of the connecting surfaces ? >> Good question. They must have the same points with the same coordinates. * >> If one of them has a sequence of points along the border edge of the >> other, it doesn't work (possibly because of numerical differences). * > > That is not right. I have to investigate it a little more. The following > image shows the re-sampling I did in lofting two differently refined > surfaces. Well, I have rechecked this. It seems that the vertices of meeting parts should be *exactly *the same. Try this code with show edges: > // tetrahedron with a missin face > p = [ [0,0,0], [10,0,0], [0,10,0], [0,0,10] ]; > f = [ [0,1,2], [0,3,1], [0,2,3] ]; > // additional faces to close it > n=3; > degface = false; > ps = [for(i=[0:n+1]) p[1]*i/(n+1) + p[2]*(n+1-i)/(n+1) ]; > fs = [for(i=[1:n+1]) [ 3, 3+i, 4+i ] ]; > df = n>0 && degface ? [for(i=[n+2:-1:1]) 3+i ] : []; > // the full tetrahedron > difference(){ > polyhedron(concat(p,ps),concat(f,fs,[df])); > cube(3,center=true); > translate([10,0,0]) cube(3,center=true); > } Forget df for while. It is an empty list. When n=0, ps will have 2 points equal to some points of list p and fs will be the missing face. The difference will be a manifold. The render is fine. When n>0, the missing face is subdivided in n parts. ps will have n+2 points and fs will have n+1 faces whose union is the missing face. The difference is no more a manifold, the render generates a warning and doesn't displays some of the difference faces. Now, a revealing trick: when degface=true, df is a degenerated face, all vertices on a line. If this face is included in the polyhedron face list, all gets right, CGAL builds a manifold from the polyhedron. This suggests that CGAL expects a correct topological specification from polyhedron even if some faces are degenerated. I think the same kind of consistence should be expected in STL files. I had not tested with F6 my last loft model. It doesn't work either. I will have to review my loft for this case creating a transition. -- View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19251.html Sent from the OpenSCAD mailing list archive at Nabble.com.