JJ
Johan Jonker
Sat, Nov 12, 2016 5:03 PM
Johan_s_examples.scad
http://forum.openscad.org/file/n19057/Johan_s_examples.scad
I have an object with seperate fingers. What I do is to sweep the fingers
separately and then join them with the base of the object. I wonder if it is
possible to sweep them in one.
In the example below it works a little but there is a connection between the
two fingers
<row>
use <naca4.scad>
use <naca_sweep.scad>
sweep (gen_double_cylinder());
function gen_double_cylinder() =
[ for (h=[1,2,3])
for (height = (h==1)? [0:1:10]:
(h==2)? [15:5:200]:
[201:1:210])
let (R = 10*(210-height/2)/210)
let (BB = (height<10)? sqrt(R*R-abs(R-height)abs(R-height)):
(height>200)? sqrt(RR-abs(200-height)abs(200-height)):
R)
let (N = round(60-R+BB))
let (LM = (height<100)? R: (height<150)? R(50-(height-100))/50:0)
let (cyl = vec3D(doublecircle(BB,LM,60)))
T_(0,0,height,cyl)];
function doublecircle(R,LM,N) =
[ for (w = [0:round(360/N):719])
let (RR=10)
let (wlm = asin(LM/10))
(w<wlm)? [Rcos(wlm),Rsin(wlm)]:
(w<90)? [Rcos(w),Rsin(w)]:
(w<180)? [Rcos(w),Rsin(w)]:
(w<270)? [Rcos(w),Rsin(w)]:
(w<360-wlm)? [Rcos(w),Rsin(w)]:
(w<360+wlm)? [Rcos(wlm),-Rsin(wlm)]:
(w<450)? [2RR-Rcos(w),-Rsin(w)]:
(w<540)? [2RR-Rcos(w),-Rsin(w)]:
(w<630)? [2RR-Rcos(w),-Rsin(w)]:
(w<720-wlm)? [2RR-Rcos(w),-Rsin(w)]:
[2RR-cos(wlm),+Rsin(wlm)]
];
</row>
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Johan_s_examples.scad
<http://forum.openscad.org/file/n19057/Johan_s_examples.scad>
I have an object with seperate fingers. What I do is to sweep the fingers
separately and then join them with the base of the object. I wonder if it is
possible to sweep them in one.
In the example below it works a little but there is a connection between the
two fingers
<row>
use <naca4.scad>
use <naca_sweep.scad>
sweep (gen_double_cylinder());
function gen_double_cylinder() =
[ for (h=[1,2,3])
for (height = (h==1)? [0:1:10]:
(h==2)? [15:5:200]:
[201:1:210])
let (R = 10*(210-height/2)/210)
let (BB = (height<10)? sqrt(R*R-abs(R-height)*abs(R-height)):
(height>200)? sqrt(R*R-abs(200-height)*abs(200-height)):
R)
let (N = round(60-R+BB))
let (LM = (height<100)? R: (height<150)? R*(50-(height-100))/50:0)
let (cyl = vec3D(doublecircle(BB,LM,60)))
T_(0,0,height,cyl)];
function doublecircle(R,LM,N) =
[ for (w = [0:round(360/N):719])
let (RR=10)
let (wlm = asin(LM/10))
(w<wlm)? [R*cos(wlm),R*sin(wlm)]:
(w<90)? [R*cos(w),R*sin(w)]:
(w<180)? [R*cos(w),R*sin(w)]:
(w<270)? [R*cos(w),R*sin(w)]:
(w<360-wlm)? [R*cos(w),R*sin(w)]:
(w<360+wlm)? [R*cos(wlm),-R*sin(wlm)]:
(w<450)? [2*RR-R*cos(w),-R*sin(w)]:
(w<540)? [2*RR-R*cos(w),-R*sin(w)]:
(w<630)? [2*RR-R*cos(w),-R*sin(w)]:
(w<720-wlm)? [2*RR-R*cos(w),-R*sin(w)]:
[2*RR-cos(wlm),+R*sin(wlm)]
];
</row>
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Sat, Nov 12, 2016 11:26 PM
This isn't specified. Sweep operates over a series of simple polygons. It
could be specified to also work with vector of a series of polygons (each
being a vector of vectors itself) or a series of a vector of polygons, but I
don't see much use for this.
But it is easy to achieve by writing your own wrapper function that will
decompose such a combined data structure, call sweep() for each component,
and union the result.
If OpenSCAD had data structures such a packing would be more explicit, but
operating with vectors of vectors of vectors of vectors data is prone to
misinterpretation, besides all the multiple self-intersection perils.
To keep track of such monster structures, it might be a good idea to
introduce some explicit typing scheme with OpenScad, otherwise you easily
get lost, when tracking errors. At least in the case you mention, it might
make a lot of sense. Here an example, how the constructors could look:
function point_xyz(x, y, z) = ["point3", [x, y, z]];
function point_v3(v3) = ["point3", [v[0], v[1], v[2]]]; // better
explicit instead of just v3
function polygon(P) = ["polygon3", P]; // might
also do an isSimple()-test
This isn't specified. Sweep operates over a series of simple polygons. It
could be specified to also work with vector of a series of polygons (each
being a vector of vectors itself) or a series of a vector of polygons, but I
don't see much use for this.
But it is easy to achieve by writing your own wrapper function that will
decompose such a combined data structure, call sweep() for each component,
and union the result.
If OpenSCAD had data structures such a packing would be more explicit, but
operating with vectors of vectors of vectors of vectors data is prone to
misinterpretation, besides all the multiple self-intersection perils.
To keep track of such monster structures, it might be a good idea to
introduce some explicit typing scheme with OpenScad, otherwise you easily
get lost, when tracking errors. At least in the case you mention, it might
make a lot of sense. Here an example, how the constructors could look:
> function point_xyz(x, y, z) = ["point3", [x, y, z]];
> function point_v3(v3) = ["point3", [v[0], v[1], v[2]]]; // better
> explicit instead of just v3
> function polygon(P) = ["polygon3", P]; // might
> also do an isSimple()-test
With this, the next step is to define type aware affine operations for this
objects. Not a big deal, but an approach that is somehow idiosyncratic.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19062.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sun, Nov 13, 2016 7:51 PM
I1ve been trying a different approach, namely to generate polyhedron data
by functions. This means to separate the data generation from the
polyhedron call. In sweeping, for example, all computations of vertices and
faces are done by a function that generates a pair of vertices,faces. A
very simple module show_data() receives this pair and pass the parameters
to the polyhedron primitive.
This approach has shown to be versatile. I recently wrote a code to build
triangular Bezier patches. To preview the patch surface I just wrote a
function to generate the polyhedron data for a triangular patch, a specific
and simple code, and send the data to the same module show_data. Another
function converts simple polygons to polyhedron data. And another converts
meshes (bi-dimensional matrix of points) to polyhedron data. Finally I have
extended the show_data module to receive a list of polyhedron data,
consolidate all of them in one polyhedron data to feed the polyhedron call
once.
This approach might be used to deal with fingers. Generate the polyhedron
data of each finger individually and send everything to show_data() or any
specific and simple substitute.
I1ve been trying a different approach, namely to generate polyhedron data
by functions. This means to separate the data generation from the
polyhedron call. In sweeping, for example, all computations of vertices and
faces are done by a function that generates a pair of vertices,faces. A
very simple module show_data() receives this pair and pass the parameters
to the polyhedron primitive.
This approach has shown to be versatile. I recently wrote a code to build
triangular Bezier patches. To preview the patch surface I just wrote a
function to generate the polyhedron data for a triangular patch, a specific
and simple code, and send the data to the same module show_data. Another
function converts simple polygons to polyhedron data. And another converts
meshes (bi-dimensional matrix of points) to polyhedron data. Finally I have
extended the show_data module to receive a list of polyhedron data,
consolidate all of them in one polyhedron data to feed the polyhedron call
once.
This approach might be used to deal with fingers. Generate the polyhedron
data of each finger individually and send everything to show_data() or any
specific and simple substitute.
JJ
Johan Jonker
Sun, Nov 13, 2016 10:20 PM
http://forum.openscad.org/file/n19083/Naamloos.jpg
The picture above shows the object that I want to make.
It is the right part of a saxophone key guard called the "engelsflugel"; a
part of a famous Keilwerth saxophone.
What I do is to make 5 objects the base of the wing and the four points of
the wing.
Each part has its owe data structure and sweep operation.
By the way. Is it possible to decrease the number of points in a the serie
of polygons in one sweep operation. For instance when near the point of the
object there are no so many points needed.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19083.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
<http://forum.openscad.org/file/n19083/Naamloos.jpg>
The picture above shows the object that I want to make.
It is the right part of a saxophone key guard called the "engelsflugel"; a
part of a famous Keilwerth saxophone.
What I do is to make 5 objects the base of the wing and the four points of
the wing.
Each part has its owe data structure and sweep operation.
By the way. Is it possible to decrease the number of points in a the serie
of polygons in one sweep operation. For instance when near the point of the
object there are no so many points needed.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19083.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Sun, Nov 13, 2016 10:22 PM
I1ve been trying a different approach, namely to generate polyhedron data
by functions. This means to separate the data generation from the
polyhedron call. In sweeping, for example, all computations of vertices
and
faces are done by a function that generates a pair of vertices,faces. A
very simple module show_data() receives this pair and pass the parameters
to the polyhedron primitive.
Ronaldo wrote
> I1ve been trying a different approach, namely to generate polyhedron data
> by functions. This means to separate the data generation from the
> polyhedron call. In sweeping, for example, all computations of vertices
> and
> faces are done by a function that generates a pair of vertices,faces. A
> very simple module show_data() receives this pair and pass the parameters
> to the polyhedron primitive.
This is exactly what the *sweep()* from Naca_sweep.scad Johan is referring
at does.
It is also the *skin()* approach.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19084.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Nov 14, 2016 7:34 PM
Rudolf,
I reread your code of sweep and I think I am going a step further. Your
module sweep receives polygonal sections, all of the same length, and builds
the polyhedron wrapping them including caps. It is a very specialized
module. In my approach, the preparation of the polyhedron data is done
externally to the module. To make it clear here is a possible code of the
module:
// Builds a polyhedron based on a list of polyhedron data
// polys - a list of polyhedron data, that is polys[i] = [ vert_list,
face_lists ]
module make_polyhedron(polys, convexity = 10) {
vertlist = [for(p=polys, pt=p[0]) pt]; // collect all verts from
polyhedra
vertlen = [for(p=polys) p[0] ];
acclen = acc_len(vertlen);
facets = [ for(i=[0:len(polys)-1], f=polys[i][1] ) [ for(v=f)
acclen[i]+v ] ];
polyhedron(
points = vertlist,
faces = facets,
convexity = convexity
);
function _accum_sum(l, offs=0, res=[]) =
len(res) == len(l) ?
res :
_accum_sum(l, offs+l[len(res)], concat(res, [ offs+l[len(res)]
] ));
function acc_len( f ) =
concat([0], _accum_sum([ for(fi=f) len(fi) ]));
}
As you see, make_polyhedron is simpler than sweep and basically unifies
polyhedron data and send it to polyhedron primitive.
As part of this approach, each kind of object requires a specialized
function to generate polyhedron data for it. For instance,
// generates polyhedron data for a mesh
// a mesh is a rectangular matrix of 3D points
function mesh2polyhedron(mesh, inv=false) =
let( n = len(mesh) != 0 ? len(mesh) : 0,
m = n==0 ? 0 : len(mesh[0]) != 0 ? len(mesh[0]) : 0 ,
l = nm)
l > 0 ?
let( range = inv ? [len(mesh)-1: -1: 0] : [0:len(mesh)-1],
vertices = l == 0 ? [] : [ for(i=range) for(pt=mesh[i]) pt ],
tris = concat( [ for(i=[0:n-2],j=[0:m-2]) [ im+j, i*m+j+1,
(i+1)m+j ] ] ,
[ for(i=[0:n-2],j=[0:m-2]) [ im+j+1,
(i+1)*m+j+1, (i+1)*m+j ] ] ) )
[ vertices, tris ]:
[] ;
// generates polyhedron data for a closed polygonal face
function polygon2polyhedron(polygon, inv=false) =
let( vertices = polygon,
range = inv ? [len(polygon)-1: -1: 0] : [0:len(polygon)-1],
facets = [[for(i=range) i ]] )
[ vertices, facets ];
Now, the application code just call the appropriate functions with pieces of
the polyhedron surface, concatenate all of them and send to make_polyhedron.
The flexibility of the approach is evident when a new kind of object (like a
Bezier triangular patch, or a sweep or loft) is created and just one
function is needed to be coded to include it in the system. If the cap of
sweep is optional, the main code may build a special cap made of Bezier
patches before sending all to make_polyhedron. And so, fingers are also
possible.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19097.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Rudolf,
I reread your code of sweep and I think I am going a step further. Your
module sweep receives polygonal sections, all of the same length, and builds
the polyhedron wrapping them including caps. It is a very specialized
module. In my approach, the preparation of the polyhedron data is done
externally to the module. To make it clear here is a possible code of the
module:
> // Builds a polyhedron based on a list of polyhedron data
> // polys - a list of polyhedron data, that is polys[i] = [ vert_list,
> face_lists ]
>
> module make_polyhedron(polys, convexity = 10) {
> vertlist = [for(p=polys, pt=p[0]) pt]; // collect all verts from
> polyhedra
> vertlen = [for(p=polys) p[0] ];
> acclen = acc_len(vertlen);
> facets = [ for(i=[0:len(polys)-1], f=polys[i][1] ) [ for(v=f)
> acclen[i]+v ] ];
>
> polyhedron(
> points = vertlist,
> faces = facets,
> convexity = convexity
> );
> function _accum_sum(l, offs=0, res=[]) =
> len(res) == len(l) ?
> res :
> _accum_sum(l, offs+l[len(res)], concat(res, [ offs+l[len(res)]
> ] ));
>
> function acc_len( f ) =
> concat([0], _accum_sum([ for(fi=f) len(fi) ]));
> }
As you see, make_polyhedron is simpler than sweep and basically unifies
polyhedron data and send it to polyhedron primitive.
As part of this approach, each kind of object requires a specialized
function to generate polyhedron data for it. For instance,
> // generates polyhedron data for a mesh
> // a mesh is a rectangular matrix of 3D points
> function mesh2polyhedron(mesh, inv=false) =
> let( n = len(mesh) != 0 ? len(mesh) : 0,
> m = n==0 ? 0 : len(mesh[0]) != 0 ? len(mesh[0]) : 0 ,
> l = n*m)
> l > 0 ?
> let( range = inv ? [len(mesh)-1: -1: 0] : [0:len(mesh)-1],
> vertices = l == 0 ? [] : [ for(i=range) for(pt=mesh[i]) pt ],
> tris = concat( [ for(i=[0:n-2],j=[0:m-2]) [ i*m+j, i*m+j+1,
> (i+1)*m+j ] ] ,
> [ for(i=[0:n-2],j=[0:m-2]) [ i*m+j+1,
> (i+1)*m+j+1, (i+1)*m+j ] ] ) )
> [ vertices, tris ]:
> [] ;
>
> // generates polyhedron data for a closed polygonal face
> function polygon2polyhedron(polygon, inv=false) =
> let( vertices = polygon,
> range = inv ? [len(polygon)-1: -1: 0] : [0:len(polygon)-1],
> facets = [[for(i=range) i ]] )
> [ vertices, facets ];
Now, the application code just call the appropriate functions with pieces of
the polyhedron surface, concatenate all of them and send to make_polyhedron.
The flexibility of the approach is evident when a new kind of object (like a
Bezier triangular patch, or a sweep or loft) is created and just one
function is needed to be coded to include it in the system. If the cap of
sweep is optional, the main code may build a special cap made of Bezier
patches before sending all to make_polyhedron. And so, fingers are also
possible.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19097.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Mon, Nov 14, 2016 10:38 PM
You are right, it is obvious that you can have a more general interface.
skin() for instance accepts polygons with different vertex numbers - and
uses some automatism to deal with that. Of course you also can prepare a
polyhedron call by just wrapping all the needed information about faces and
vertices into a common structure and unwrap again before doing the call.
But isn't that more an interface rather than an abstraction that uses some
regularization to reduce the amount of information (and preparation) to be
passed? The former is how I understand your approach - at least from the
code you show. Knowing your stuff a bit, I suppose there is some more magic
behind, e.g. where your beziers come into play.
What do I mean by magic? When I designed sweep() my primary aim was to get a
tool for generalized extrusions that allows for refinement by using
interpolation schemes (applicable by the polygon generator AND the path
generator). The secondary aim was to have all "knitting" be done by the
function. The price for this "magic" was some structural constraints, like
- all polygons must be simple and have an equal number of points - which
skin() doesn't require
- each two subsequent polygons get connected with a fixed scheme: n-th
vertex to n-th vertex
- polygons must describe a non-selfintersecting extrusion path
From a topological point of view this is of course not even the tip of the
iceberg but it is a milestone away from what linear_extrude() can do. You
are welcome to define new schemes that allow e.g. to define extrusions with
furcations and anastomoses. But: as long as I have to compose the full
points list AND full faces list on my own, I don't see much progress. It is
the (hidden) magic that turns an interface into a new concept.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19102.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
You are right, it is obvious that you can have a more general interface.
*skin()* for instance accepts polygons with different vertex numbers - and
uses some automatism to deal with that. Of course you also can prepare a
polyhedron call by just wrapping all the needed information about faces and
vertices into a common structure and unwrap again before doing the call.
But isn't that more an interface rather than an abstraction that uses some
regularization to reduce the amount of information (and preparation) to be
passed? The former is how I understand your approach - at least from the
code you show. Knowing your stuff a bit, I suppose there is some more magic
behind, e.g. where your beziers come into play.
What do I mean by magic? When I designed sweep() my primary aim was to get a
tool for generalized extrusions that allows for refinement by using
interpolation schemes (applicable by the polygon generator AND the path
generator). The secondary aim was to have all "knitting" be done by the
function. The price for this "magic" was some structural constraints, like
1. all polygons must be simple and have an equal number of points - which
*skin()* doesn't require
2. each two subsequent polygons get connected with a fixed scheme: n-th
vertex to n-th vertex
3. polygons must describe a non-selfintersecting extrusion path
>From a topological point of view this is of course not even the tip of the
iceberg but it is a milestone away from what linear_extrude() can do. You
are welcome to define new schemes that allow e.g. to define extrusions with
furcations and anastomoses. But: as long as I have to compose the full
points list AND full faces list on my own, I don't see much progress. It is
the (hidden) magic that turns an interface into a new concept.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19102.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Fri, Nov 18, 2016 12:28 AM
Rudolf,
I agree with you. My observations about how to connect parts in one module
to render a polyhedron is a low level technique. My point is that it is a
very flexible one and it allows many different uses, and that is an
important property in low level stages. I expect that this will become
apparent in the following.
Yes, I have a dream! I want to render organic models in OpenSCAD.
When I started to write my Bezier library in OpenSCAD I had no idea how to
integrated it. Soon I realized that in a non-interactive environment like
OpenSCAD, the Bezier control points are as hard to work with as the
definition of faces of a complex polyhedron. So I needed to address those
two issues.
At first, I worked in modules to help me to visualize and debug Bezier
curves and tensor product surfaces. Those are non-manifold geometries. To
build a model to be rendered I needed a module to integrate a list of
surface patch meshes with a list of faces in one polyhedron complying the
manifold topology: an output module. This task was simplified by one key
observation: the list of vertices of a polyhedron may have many incarnations
of the same vertex coordinates and two different faces will be connected
even when they refer to different incarnations of the same vertex. CGAL
seems to collapse all vertices with same coordinates and connect faces based
on vertex coordinates, similar to STL processing. This observation
simplified a lot the task of integrating many surfaces in one polyhedron:
each face may be processed individually.
The first issue, how to deal with the definition of lots of control points
of a model, is bit harder to solve. After the implementation of spline
interpolation methods I started to explore loft techniques to connect
"automatically" individual surface patches. The following image depict one
of those experiment.
http://forum.openscad.org/file/n19203/loft_experiment.png
The model in the back plane shows an exploded view of the middle one. It is
composed by 5 parts: two rounded caps, two splines surfaces interpolating
the blue-marked points and a cubic loft surface connecting them. All
surfaces are C2 and all surface-surface meetings are G1, geometrically
differentiable. When all the meshes of those 5 patches are integrated in one
polyhedron we have one acceptable CGAL manifold. It can boolean operated.
No, not yet! As you see in this thrown together image, some faces are
wrongly oriented. To repair this you can either change the surface
definitions accordingly or, easier, just mark them to be reverted by the
output module.
This is the current state of my "magic", as you call it. 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.
But my goal is a bit further. I want to integrate triangular Bezier patches
and create shapes with genus. After all, the model above is nothing more
than a generalized sweep, skin or loft with rounded caps. I have no tools
yet to create a model with genus. If to be able to build models with genus I
need to model furcations and anastomoses and, therewith, fingers and hands!
And this is the "magic" I am pursuing now.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19203.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Rudolf,
I agree with you. My observations about how to connect parts in one module
to render a polyhedron is a low level technique. My point is that it is a
very flexible one and it allows many different uses, and that is an
important property in low level stages. I expect that this will become
apparent in the following.
Yes, I have a dream! I want to render organic models in OpenSCAD.
When I started to write my Bezier library in OpenSCAD I had no idea how to
integrated it. Soon I realized that in a non-interactive environment like
OpenSCAD, the Bezier control points are as hard to work with as the
definition of faces of a complex polyhedron. So I needed to address those
two issues.
At first, I worked in modules to help me to visualize and debug Bezier
curves and tensor product surfaces. Those are non-manifold geometries. To
build a model to be rendered I needed a module to integrate a list of
surface patch meshes with a list of faces in one polyhedron complying the
manifold topology: an output module. This task was simplified by one key
observation: the list of vertices of a polyhedron may have many incarnations
of the same vertex coordinates and two different faces will be connected
even when they refer to different incarnations of the same vertex. CGAL
seems to collapse all vertices with same coordinates and connect faces based
on vertex coordinates, similar to STL processing. This observation
simplified a lot the task of integrating many surfaces in one polyhedron:
each face may be processed individually.
The first issue, how to deal with the definition of lots of control points
of a model, is bit harder to solve. After the implementation of spline
interpolation methods I started to explore loft techniques to connect
"automatically" individual surface patches. The following image depict one
of those experiment.
<http://forum.openscad.org/file/n19203/loft_experiment.png>
The model in the back plane shows an exploded view of the middle one. It is
composed by 5 parts: two rounded caps, two splines surfaces interpolating
the blue-marked points and a cubic loft surface connecting them. All
surfaces are C2 and all surface-surface meetings are G1, geometrically
differentiable. When all the meshes of those 5 patches are integrated in one
polyhedron we have one acceptable CGAL manifold. It can boolean operated.
No, not yet! As you see in this thrown together image, some faces are
wrongly oriented. To repair this you can either change the surface
definitions accordingly or, easier, just mark them to be reverted by the
output module.
This is the current state of my "magic", as you call it. 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.
But my goal is a bit further. I want to integrate triangular Bezier patches
and create shapes with genus. After all, the model above is nothing more
than a generalized sweep, skin or loft with rounded caps. I have no tools
yet to create a model with genus. If to be able to build models with genus I
need to model furcations and anastomoses and, therewith, fingers and hands!
And this is the "magic" I am pursuing now.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19203.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Fri, Nov 18, 2016 3:50 PM
Ronaldo, I expected something like this and I am looking forward to see your
patchwork approach implemented as fullgrown concept, which will be a long
way to go, especially when you want address different genera. It was also my
first impression about the use of Beziers in OpenSCAD that you will easily
get lost without having at least a minimum of (preferable GUI)
interactivity.
I like your idea,
CGAL seems to collapse all vertices with same coordinates and connect
faces based on vertex coordinates, similar to STL processing. This
observation simplified a lot the task of integrating many surfaces in one
polyhedron: each face may be processed individually.
but as far as I know, this is not documented and might change in future.
Usually it is not a good idea, to build new cities on such grounding. Maybe
one from the dev team can say more about this.
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.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19218.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ronaldo, I expected something like this and I am looking forward to see your
patchwork approach implemented as fullgrown concept, which will be a long
way to go, especially when you want address different genera. It was also my
first impression about the use of Beziers in OpenSCAD that you will easily
get lost without having at least a minimum of (preferable GUI)
interactivity.
I like your idea,
> CGAL seems to collapse all vertices with same coordinates and connect
> faces based on vertex coordinates, similar to STL processing. This
> observation simplified a lot the task of integrating many surfaces in one
> polyhedron: each face may be processed individually.
but as far as I know, this is not documented and might change in future.
Usually it is not a good idea, to build new cities on such grounding. Maybe
one from the dev team can say more about this.
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.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19218.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Fri, Nov 18, 2016 5:25 PM
Ronaldo said "Yes, I have a dream! I want to render organic models in
OpenSCAD."
+1. I want to do this too.
On 17 November 2016 at 19:28, Ronaldo rcmpersiano@gmail.com wrote:
Rudolf,
I agree with you. My observations about how to connect parts in one module
to render a polyhedron is a low level technique. My point is that it is a
very flexible one and it allows many different uses, and that is an
important property in low level stages. I expect that this will become
apparent in the following.
Yes, I have a dream! I want to render organic models in OpenSCAD.
When I started to write my Bezier library in OpenSCAD I had no idea how to
integrated it. Soon I realized that in a non-interactive environment like
OpenSCAD, the Bezier control points are as hard to work with as the
definition of faces of a complex polyhedron. So I needed to address those
two issues.
At first, I worked in modules to help me to visualize and debug Bezier
curves and tensor product surfaces. Those are non-manifold geometries. To
build a model to be rendered I needed a module to integrate a list of
surface patch meshes with a list of faces in one polyhedron complying the
manifold topology: an output module. This task was simplified by one key
observation: the list of vertices of a polyhedron may have many
incarnations
of the same vertex coordinates and two different faces will be connected
even when they refer to different incarnations of the same vertex. CGAL
seems to collapse all vertices with same coordinates and connect faces
based
on vertex coordinates, similar to STL processing. This observation
simplified a lot the task of integrating many surfaces in one polyhedron:
each face may be processed individually.
The first issue, how to deal with the definition of lots of control points
of a model, is bit harder to solve. After the implementation of spline
interpolation methods I started to explore loft techniques to connect
"automatically" individual surface patches. The following image depict one
of those experiment.
http://forum.openscad.org/file/n19203/loft_experiment.png
The model in the back plane shows an exploded view of the middle one. It is
composed by 5 parts: two rounded caps, two splines surfaces interpolating
the blue-marked points and a cubic loft surface connecting them. All
surfaces are C2 and all surface-surface meetings are G1, geometrically
differentiable. When all the meshes of those 5 patches are integrated in
one
polyhedron we have one acceptable CGAL manifold. It can boolean operated.
No, not yet! As you see in this thrown together image, some faces are
wrongly oriented. To repair this you can either change the surface
definitions accordingly or, easier, just mark them to be reverted by the
output module.
This is the current state of my "magic", as you call it. 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.
But my goal is a bit further. I want to integrate triangular Bezier patches
and create shapes with genus. After all, the model above is nothing more
than a generalized sweep, skin or loft with rounded caps. I have no tools
yet to create a model with genus. If to be able to build models with genus
I
need to model furcations and anastomoses and, therewith, fingers and hands!
And this is the "magic" I am pursuing now.
--
View this message in context: http://forum.openscad.org/Can-
you-sweep-a-object-with-fingers-tp19057p19203.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ronaldo said "Yes, I have a dream! I want to render organic models in
OpenSCAD."
+1. I want to do this too.
On 17 November 2016 at 19:28, Ronaldo <rcmpersiano@gmail.com> wrote:
> Rudolf,
>
> I agree with you. My observations about how to connect parts in one module
> to render a polyhedron is a low level technique. My point is that it is a
> very flexible one and it allows many different uses, and that is an
> important property in low level stages. I expect that this will become
> apparent in the following.
>
> Yes, I have a dream! I want to render organic models in OpenSCAD.
>
> When I started to write my Bezier library in OpenSCAD I had no idea how to
> integrated it. Soon I realized that in a non-interactive environment like
> OpenSCAD, the Bezier control points are as hard to work with as the
> definition of faces of a complex polyhedron. So I needed to address those
> two issues.
>
> At first, I worked in modules to help me to visualize and debug Bezier
> curves and tensor product surfaces. Those are non-manifold geometries. To
> build a model to be rendered I needed a module to integrate a list of
> surface patch meshes with a list of faces in one polyhedron complying the
> manifold topology: an output module. This task was simplified by one key
> observation: the list of vertices of a polyhedron may have many
> incarnations
> of the same vertex coordinates and two different faces will be connected
> even when they refer to different incarnations of the same vertex. CGAL
> seems to collapse all vertices with same coordinates and connect faces
> based
> on vertex coordinates, similar to STL processing. This observation
> simplified a lot the task of integrating many surfaces in one polyhedron:
> each face may be processed individually.
>
> The first issue, how to deal with the definition of lots of control points
> of a model, is bit harder to solve. After the implementation of spline
> interpolation methods I started to explore loft techniques to connect
> "automatically" individual surface patches. The following image depict one
> of those experiment.
>
> <http://forum.openscad.org/file/n19203/loft_experiment.png>
>
> The model in the back plane shows an exploded view of the middle one. It is
> composed by 5 parts: two rounded caps, two splines surfaces interpolating
> the blue-marked points and a cubic loft surface connecting them. All
> surfaces are C2 and all surface-surface meetings are G1, geometrically
> differentiable. When all the meshes of those 5 patches are integrated in
> one
> polyhedron we have one acceptable CGAL manifold. It can boolean operated.
> No, not yet! As you see in this thrown together image, some faces are
> wrongly oriented. To repair this you can either change the surface
> definitions accordingly or, easier, just mark them to be reverted by the
> output module.
>
> This is the current state of my "magic", as you call it. 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.
>
> But my goal is a bit further. I want to integrate triangular Bezier patches
> and create shapes with genus. After all, the model above is nothing more
> than a generalized sweep, skin or loft with rounded caps. I have no tools
> yet to create a model with genus. If to be able to build models with genus
> I
> need to model furcations and anastomoses and, therewith, fingers and hands!
>
> And this is the "magic" I am pursuing now.
>
>
>
>
>
> --
> View this message in context: http://forum.openscad.org/Can-
> you-sweep-a-object-with-fingers-tp19057p19203.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
R
Ronaldo
Fri, Nov 18, 2016 10:16 PM
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
One of the problems is how to easily specify the topology so that a
suitable geometry could be created.
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
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
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 ); $ 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 ); $ 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
@ 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 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
@ 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, 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).
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, 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.
R
runsun
Sat, Nov 19, 2016 10:13 PM
Well, I have rechecked this. It seems that the vertices of meeting parts
should be
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);
}
Have you noticed that there are always 2 cases of duplications?
p= [ A,B,C,D];
n=0: ps= [ C,B ]; p+ps => [A,B,C,D, C,B];
n=1: ps= [ C,P, B ]; p+ps => [A,B,C,D, C,P,B];
n=2: ps= [ C,P, Q, B ]; p+ps => [A,B,C,D, C,P,Q,B];
n=3: ps= [ C,P, Q, R, B ]; p+ps => [A,B,C,D, C,P,Q,R,B];
B and C are always duplicated regardless of n.
$ 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-tp19057p19252.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ronaldo wrote
> 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);
>> }
Have you noticed that there are always 2 cases of duplications?
p= [ A,B,C,D];
n=0: ps= [ C,B ]; p+ps => [A,B,C,D, C,B];
n=1: ps= [ C,P, B ]; p+ps => [A,B,C,D, C,P,B];
n=2: ps= [ C,P, Q, B ]; p+ps => [A,B,C,D, C,P,Q,B];
n=3: ps= [ C,P, Q, R, B ]; p+ps => [A,B,C,D, C,P,Q,R,B];
B and C are always duplicated regardless of n.
-----
$ 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-tp19057p19252.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sat, Nov 19, 2016 10:21 PM
Yes, I aware of it. It causes no harm as discussed before. I explore that
in my codes.
2016-11-19 20:13 GMT-02:00 runsun runsun@gmail.com:
Well, I have rechecked this. It seems that the vertices of meeting parts
should be
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);
}
Have you noticed that there are always 2 cases of duplications?
p= [ A,B,C,D];
n=0: ps= [ C,B ]; p+ps => [A,B,C,D, C,B];
n=1: ps= [ C,P, B ]; p+ps => [A,B,C,D, C,P,B];
n=2: ps= [ C,P, Q, B ]; p+ps => [A,B,C,D, C,P,Q,B];
n=3: ps= [ C,P, Q, R, B ]; p+ps => [A,B,C,D, C,P,Q,R,B];
B and C are always duplicated regardless of n.
$ 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-tp19057p19252.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Yes, I aware of it. It causes no harm as discussed before. I explore that
in my codes.
2016-11-19 20:13 GMT-02:00 runsun <runsun@gmail.com>:
> Ronaldo wrote
> > 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);
> >> }
>
> Have you noticed that there are always 2 cases of duplications?
>
> p= [ A,B,C,D];
>
> n=0: ps= [ C,B ]; p+ps => [A,B,C,D, C,B];
> n=1: ps= [ C,P, B ]; p+ps => [A,B,C,D, C,P,B];
> n=2: ps= [ C,P, Q, B ]; p+ps => [A,B,C,D, C,P,Q,B];
> n=3: ps= [ C,P, Q, R, B ]; p+ps => [A,B,C,D, C,P,Q,R,B];
>
> B and C are always duplicated regardless of n.
>
>
>
>
>
> -----
>
> $ 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-tp19057p19252.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
R
runsun
Sun, Nov 20, 2016 12:40 AM
Thx, Ronaldo. The understanding of no need to be exact same number of points
on both faces could save a lot of troubles.
$ 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-tp19057p19256.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thx, Ronaldo. The understanding of no need to be exact same number of points
on both faces could save a lot of troubles.
-----
$ 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-tp19057p19256.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sun, Nov 20, 2016 3:04 AM
I am not sure I have understood your understanding.
2016-11-19 22:40 GMT-02:00 runsun runsun@gmail.com:
Thx, Ronaldo. The understanding of no need to be exact same number of
points
on both faces could save a lot of troubles.
I am not sure I have understood your understanding.
2016-11-19 22:40 GMT-02:00 runsun <runsun@gmail.com>:
> Thx, Ronaldo. The understanding of no need to be exact same number of
> points
> on both faces could save a lot of troubles.
>
>
>
R
runsun
Sun, Nov 20, 2016 3:43 AM
@Ronaldo: I think I didn't think through it clearly. You are right to point
that out.
What interests me is the re-sampling process to match two surfaces. I'd be
interested how you achieved that as in the following fig:
http://forum.openscad.org/file/n19259/161119_Ronaldo_re-sampling.png
Or how Parkinrob achieves his:
http://forum.openscad.org/file/n15173/showcase6.png
A while ago I was solving a similar/related situation (of joining two
polys), and I figured that a resampling approach is needed. This attempt was
reflected in a forum post
http://forum.openscad.org/Polyhedron-tube-with-irregular-sides-is-it-possible-td13813.html
in which I was looking for a solution to punch an irregular hole in a poly
plan, 'cos I believe that is the basic for lofting, which is essential for
poly joining.
Later I came up with a preliminary solution of re-sampling:
http://forum.openscad.org/file/n13824/20150914_irregular_tube_paring.png
It is still far from "irregular hole", but already can do lots of cool
stuff.
$ 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-tp19057p19259.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Ronaldo: I think I didn't think through it clearly. You are right to point
that out.
What interests me is the re-sampling process to match two surfaces. I'd be
interested how you achieved that as in the following fig:
<http://forum.openscad.org/file/n19259/161119_Ronaldo_re-sampling.png>
Or how Parkinrob achieves his:
<http://forum.openscad.org/file/n15173/showcase6.png>
A while ago I was solving a similar/related situation (of joining two
polys), and I figured that a resampling approach is needed. This attempt was
reflected in a forum post
<http://forum.openscad.org/Polyhedron-tube-with-irregular-sides-is-it-possible-td13813.html>
in which I was looking for a solution to punch an irregular hole in a poly
plan, 'cos I believe that is the basic for lofting, which is essential for
poly joining.
Later I came up with a preliminary solution of re-sampling:
<http://forum.openscad.org/file/n13824/20150914_irregular_tube_paring.png>
It is still far from "irregular hole", but already can do lots of cool
stuff.
-----
$ 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-tp19057p19259.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Sun, Nov 20, 2016 1:49 PM
@Ronaldo: I think I didn't think through it clearly. You are right to
point that out.
What interests me is the re-sampling process to match two surfaces. I'd be
interested how you achieved that as in the following fig:
runsun, the re-sampling I use is a simple process. First, compute (for each
polygon) the list of the distances along the polygon border from each vertex
to the starting vertex: they are ascending-ordered lists. Normalize the two
lists, dividing each one by its maximum. Then, both start with zero and end
with 1. Refer to the figure where the blue dots represent one list and the
green dots the other:
http://forum.openscad.org/file/n19267/resampling2.png
Now merge the lists (like in merge sort) with one difference: if the same
value is found in both lists, put just one in the output list (the red dot
in the output list). Use the output list to re-sample both polygon by doing
appropriate interpolations. I am sure you would be able to write this
algorithm but I may provide my codes if you need.
Another approach is taken by skin() in list comprehension demos. Suppose the
one polygon has n vertices more then the other. The skin() algorithm inserts
n new vertices (Linde calls them Steiner points) in the "smaller" one. The
method inserts one at a time in the longest edge splitting it in half, with
an additional care: if the longest edge is not an original polygon edge, it
removes the k previously inserted vertices from it and inserts k+1
subdividing the edge equally. In fact, it is more efficient than that but
with the same result.
I don't use this method because it is more complex and it is not continuous
with the vertex positions: a small change in a vertex may cause a big change
in the re-sampling. Anyway, I have a clearer and commented implementation of
the method if you need it.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19267.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
runsun wrote
> @Ronaldo: I think I didn't think through it clearly. You are right to
> point that out.
>
> What interests me is the re-sampling process to match two surfaces. I'd be
> interested how you achieved that as in the following fig:
runsun, the re-sampling I use is a simple process. First, compute (for each
polygon) the list of the distances along the polygon border from each vertex
to the starting vertex: they are ascending-ordered lists. Normalize the two
lists, dividing each one by its maximum. Then, both start with zero and end
with 1. Refer to the figure where the blue dots represent one list and the
green dots the other:
<http://forum.openscad.org/file/n19267/resampling2.png>
Now merge the lists (like in merge sort) with one difference: if the same
value is found in both lists, put just one in the output list (the red dot
in the output list). Use the output list to re-sample both polygon by doing
appropriate interpolations. I am sure you would be able to write this
algorithm but I may provide my codes if you need.
Another approach is taken by skin() in list comprehension demos. Suppose the
one polygon has n vertices more then the other. The skin() algorithm inserts
n new vertices (Linde calls them Steiner points) in the "smaller" one. The
method inserts one at a time in the longest edge splitting it in half, with
an additional care: if the longest edge is not an original polygon edge, it
removes the k previously inserted vertices from it and inserts k+1
subdividing the edge equally. In fact, it is more efficient than that but
with the same result.
I don't use this method because it is more complex and it is not continuous
with the vertex positions: a small change in a vertex may cause a big change
in the re-sampling. Anyway, I have a clearer and commented implementation of
the method if you need it.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19267.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Sun, Nov 20, 2016 4:55 PM
@Ronaldo, ah ha ! The moment I spotted your figure, I see how you did it
right away. It turns out that my method is the same as what you described in
the skin() approach, and, as you mentioned, it's much more difficult to
code. I actually moved a step further to insert points bidirectionally ---
that is, insert points that are missing on both polys. That made it even
more troublesome. I'll see if I can apply your approach. Thx.
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19269.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Ronaldo, ah ha ! The moment I spotted your figure, I see how you did it
right away. It turns out that my method is the same as what you described in
the skin() approach, and, as you mentioned, it's much more difficult to
code. I actually moved a step further to insert points bidirectionally ---
that is, insert points that are missing on both polys. That made it even
more troublesome. I'll see if I can apply your approach. Thx.
-----
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19269.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Sun, Nov 20, 2016 9:20 PM
@Ronaldo, ah ha ! The moment I spotted your figure, I see how you did it
right away. It turns out that my method is the same as what you described
in
the skin() approach, and, as you mentioned, it's much more difficult to
code. I actually moved a step further to insert points bidirectionally ---
that is, insert points that are missing on both polys. That made it even
more troublesome. I'll see if I can apply your approach. Thx.
I do insert points in both polygon. Curiously, you image
irregular_tube_paring suggested me something similar to what I do and not
what skin() does.
2016-11-20 14:55 GMT-02:00 runsun <runsun@gmail.com>:
> @Ronaldo, ah ha ! The moment I spotted your figure, I see how you did it
> right away. It turns out that my method is the same as what you described
> in
> the skin() approach, and, as you mentioned, it's much more difficult to
> code. I actually moved a step further to insert points bidirectionally ---
> that is, insert points that are missing on both polys. That made it even
> more troublesome. I'll see if I can apply your approach. Thx.
>
I do insert points in both polygon. Curiously, you image
irregular_tube_paring suggested me something similar to what I do and not
what skin() does.
R
runsun
Mon, Nov 21, 2016 1:40 AM
I think the basic idea is probably the same, but in my case, I use "angle to
the starting point" as a comparison criteria for point-insertion, you use
"ratio of length to the starting point". In my first impression, ratio
should be easier than angle. For one thing, calculating "angle" will require
a common center for both surfaces, which brings a whole new problem to solve
(how to identify this common center when the surface is irregular). The use
of "ratio" will require no such center, which is what I think the main
difference.
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19279.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I think the basic idea is probably the same, but in my case, I use "angle to
the starting point" as a comparison criteria for point-insertion, you use
"ratio of length to the starting point". In my first impression, ratio
should be easier than angle. For one thing, calculating "angle" will require
a common center for both surfaces, which brings a whole new problem to solve
(how to identify this common center when the surface is irregular). The use
of "ratio" will require no such center, which is what I think the main
difference.
-----
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19279.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Nov 21, 2016 4:02 PM
I found a first simple scheme to make a furcation:
http://forum.openscad.org/file/n19289/Junction.png
The incomming data are the three mouth closed arcs and its traversal
derivatives. The surface is composed of three rectangular and three
triangular Bezier patches. The joint at the green lines is continuous but
not C1. To have a C1 joint the mouth arcs should be cubic splines at least
C1 and the triangular patch has to be divided in three triangular Bezier
patches in a Clough-Tocher subdivision.
This scheme is not easily extended for more mouths. The top and bottom
triangles would turn into more sided polygons and a different subdivision
must be devised. But any way, this experiment shows that at least a hand
with 2 fingers is feasible by terminating sweeps/skins at the three mouths.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19289.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I found a first simple scheme to make a furcation:
<http://forum.openscad.org/file/n19289/Junction.png>
The incomming data are the three mouth closed arcs and its traversal
derivatives. The surface is composed of three rectangular and three
triangular Bezier patches. The joint at the green lines is continuous but
not C1. To have a C1 joint the mouth arcs should be cubic splines at least
C1 and the triangular patch has to be divided in three triangular Bezier
patches in a Clough-Tocher subdivision.
This scheme is not easily extended for more mouths. The top and bottom
triangles would turn into more sided polygons and a different subdivision
must be devised. But any way, this experiment shows that at least a hand
with 2 fingers is feasible by terminating sweeps/skins at the three mouths.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19289.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Mon, Nov 21, 2016 5:28 PM
Correction: the surface is composed of three rectangular and two triangular
patches.
Correction: the surface is composed of three rectangular and two triangular
patches.
R
runsun
Mon, Nov 21, 2016 8:29 PM
@Ronaldo,
What formula did you apply to obtain a triangular Bezier patch? I haven't
got to adventure beyond Bezier curves before I was distracted away from
OpenSCAD.
Btw, with your success of the bifurcation above, I think it's very close to
making a full hand --- instead of trying to come up with a poly of multiple
mouths, it should be easier to stitch multiple of above figures into one
hand of 5 fingers.
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19300.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Ronaldo,
What formula did you apply to obtain a triangular Bezier patch? I haven't
got to adventure beyond Bezier curves before I was distracted away from
OpenSCAD.
Btw, with your success of the bifurcation above, I think it's very close to
making a full hand --- instead of trying to come up with a poly of multiple
mouths, it should be easier to stitch multiple of above figures into one
hand of 5 fingers.
-----
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19300.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Nov 21, 2016 9:08 PM
What formula did you apply to obtain a triangular Bezier patch? I haven't
got to adventure beyond Bezier curves before I was distracted away from
OpenSCAD.
What do you mean by formula? Triangular Bezier patches are defined by a
triangular array of control points. To evaluate a point in it, I apply its
recursive evaluation definition (Casteljau). To generate a triangular mesh I
evaluate it in a regular triangular grid of the parameters. And to display
it I pass the list of triangles of the triangular evaluation mesh to
polyhedron. All done by a set of small functions.
Btw, with your success of the bifurcation above, I think it's very close
to making a full hand --- instead of trying to come up with a poly of
multiple mouths, it should be easier to stitch multiple of above figures
into one hand of 5 fingers.
Yes, I know it but then the "hand" will be subdivided by lot of patches and
all the stuff will be harder to assemble. What I want is a general scheme
that works with a n-furcation so to speak: given n mouths it computes the
n-furcation. Using the scheme I sketched, in a 5-furcation, I will need to
compute two pentagonal C1 patches. That patches could be naturally split in
triangles. However, the C1 interpolation methods for arbitrary
triangulations are harder to compute and have many limitations. I am still
researching this.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19306.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
runsun wrote
> What formula did you apply to obtain a triangular Bezier patch? I haven't
> got to adventure beyond Bezier curves before I was distracted away from
> OpenSCAD.
What do you mean by formula? Triangular Bezier patches are defined by a
triangular array of control points. To evaluate a point in it, I apply its
recursive evaluation definition (Casteljau). To generate a triangular mesh I
evaluate it in a regular triangular grid of the parameters. And to display
it I pass the list of triangles of the triangular evaluation mesh to
polyhedron. All done by a set of small functions.
> Btw, with your success of the bifurcation above, I think it's very close
> to making a full hand --- instead of trying to come up with a poly of
> multiple mouths, it should be easier to stitch multiple of above figures
> into one hand of 5 fingers.
Yes, I know it but then the "hand" will be subdivided by lot of patches and
all the stuff will be harder to assemble. What I want is a general scheme
that works with a n-furcation so to speak: given n mouths it computes the
n-furcation. Using the scheme I sketched, in a 5-furcation, I will need to
compute two pentagonal C1 patches. That patches could be naturally split in
triangles. However, the C1 interpolation methods for arbitrary
triangulations are harder to compute and have many limitations. I am still
researching this.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19306.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Mon, Nov 21, 2016 9:51 PM
@Ronaldo, That's good enough for me for now. Thx for the explanation.
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19308.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Ronaldo, That's good enough for me for now. Thx for the explanation.
-----
$ 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 , triang ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19308.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Nov 21, 2016 10:27 PM
Any way, if someone wants to play with triangular patches here are my codes
to start with:
// Tpatch is any triangular array of 3D points
// an example of a degree 3 Bezier Tpatch control points
p = 10*[ [ [0,0,3] ],
[ [1.5,0.5,5], [1.5,2.5,6] ],
[ [3,0,3], [3.5,1,3], [3,3,3] ],
[ [4,-1,3], [5,1.5,1], [4.5,4.5,1], [4,6,3] ] ];
n = 10;
justTpatch = false; // set true to see a solid (manifold) model
// Bezier Tpatch mesh
btp = Bezier_Tpatch_mesh(p,n);
// Bezier Tpatch converted to polyhedron data format
bp = Tpatch2polyhedron(btp,inv=true);
// three polygons meeting the Bezier Tpatch borders
p1 = polygon2polyhedron(concat([[0,0,0]], [for(q=btp) q[0]]));
p2 = polygon2polyhedron(concat([[0,0,0]], [for(q=btp)
q[len(q)-1]]),inv=true);
p3 = polygon2polyhedron(concat([[0,0,0]], btp[len(btp)-1]));
if(justTpatch)
color("red") make_polyhedron([bp]);
else
make_polyhedron([ bp,p1,p2,p3 ]);
// evaluates a Bezier Tpatch with control points p in a parameter space
point (u,v)
function Bezier_Tpatch_eval(p,u,v,degree=3) =
let( l = $from==undef? [0,0]: $from,
i = l[0], j = l[1], w = 1-u-v )
degree==1?
up[i][j] + vp[i+1][j] + wp[i+1][j+1] :
uBezier_Tpatch_eval(p,u,v,degree-1,$from=l)
+ vBezier_Tpatch_eval(p,u,v,degree-1,$from=l+[1,0])
+ wBezier_Tpatch_eval(p,u,v,degree-1,$from=l+[1,1]);
// builds a triangular mesh (itself a Tpatch) evaluating the Bezier Tpatch
p
// in a regular triangular grid of size n
function Bezier_Tpatch_mesh(p,n) =
let(degree=len(p)-1)
[ for(i=[n:-1:0]) [ for(j=[n-i:-1:0])
Bezier_Tpatch_eval(p,i/n,j/n,degree) ] ];
// converts Tpatch tp to a polyhedron data [ vertices, tris ] format;
// inv=true reverses the circulation order
function Tpatch2polyhedron(tp, inv=false) =
let( n = len(tp) != 0 ? len(tp) : 0,
vertices = n == 0 ? [] : [ for(l=tp) for(pt=l) pt ],
tris = concat( [ for(i=[0:n-2], j=[0:i], st=i*(i+1)/2 )
inv ? [ st+j, st+i+j+2, st+i+1+j ]:
[ st+j, st+i+1+j, st+i+j+2 ] ] ,
[ for(i=[1:n-2], j=[0:i-1], st=i*(i+1)/2 )
inv ? [ st+j, st+j+1, st+i+j+2 ] :
[ st+j, st+i+j+2, st+j+1 ] ] ) )
[ vertices, tris ];
// converts a polygon poly to a polyhedron data [ vertices, tris ] format;
// inv=true reverses the circulation order
function polygon2polyhedron(poly, inv=false) =
let( vertices = poly,
range = inv ? [len(poly)-1: -1: 0] : [0:len(poly)-1],
facets = [[for(i=range) i ]] )
[ vertices, facets ];
// generates a polyhedron with the surface of a Tpatch p with color c
module show_Tpatch(p,c="yellow") {
q = Tpatch2polyhedron(p);
color(c) make_polyhedron([ q ]);
}
// generates one polyhedron composed by the polyhedron data in list polys
module make_polyhedron(polys, convexity = 10) {
function _accum_sum(l, offs=0, res=[0]) =
len(res) == len(l) ?
res :
_accum_sum(l, offs+l[len(res)-1], concat(res, [
offs+l[len(res)-1] ] ));
vertlist = [for(p=polys, pt=p[0]) pt]; // collect all verts from
polyhedra
vertlens = [for(p=polys) len(p[0]) ]; // number of vertices of each
polyhedron data
acclens = _accum_sum(vertlens); // accumulated sum of the vertex set
sizes to offset face indices
facets = [ for(i=[0:len(polys)-1], f=polys[i][1] ) [ for(v=f)
acclens[i]+v ] ];
polyhedron(
points = vertlist,
faces = facets,
convexity = convexity
);
}
Any way, if someone wants to play with triangular patches here are my codes
to start with:
> // Tpatch is any triangular array of 3D points
>
> // an example of a degree 3 Bezier Tpatch control points
> p = 10*[ [ [0,0,3] ],
> [ [1.5,0.5,5], [1.5,2.5,6] ],
> [ [3,0,3], [3.5,1,3], [3,3,3] ],
> [ [4,-1,3], [5,1.5,1], [4.5,4.5,1], [4,6,3] ] ];
>
> n = 10;
> justTpatch = false; // set true to see a solid (manifold) model
>
> // Bezier Tpatch mesh
> btp = Bezier_Tpatch_mesh(p,n);
> // Bezier Tpatch converted to polyhedron data format
> bp = Tpatch2polyhedron(btp,inv=true);
>
> // three polygons meeting the Bezier Tpatch borders
> p1 = polygon2polyhedron(concat([[0,0,0]], [for(q=btp) q[0]]));
> p2 = polygon2polyhedron(concat([[0,0,0]], [for(q=btp)
> q[len(q)-1]]),inv=true);
> p3 = polygon2polyhedron(concat([[0,0,0]], btp[len(btp)-1]));
>
> if(justTpatch)
> color("red") make_polyhedron([bp]);
> else
> make_polyhedron([ bp,p1,p2,p3 ]);
>
> // evaluates a Bezier Tpatch with control points p in a parameter space
> point (u,v)
> function Bezier_Tpatch_eval(p,u,v,degree=3) =
> let( l = $from==undef? [0,0]: $from,
> i = l[0], j = l[1], w = 1-u-v )
> degree==1?
> u*p[i][j] + v*p[i+1][j] + w*p[i+1][j+1] :
> u*Bezier_Tpatch_eval(p,u,v,degree-1,$from=l)
> + v*Bezier_Tpatch_eval(p,u,v,degree-1,$from=l+[1,0])
> + w*Bezier_Tpatch_eval(p,u,v,degree-1,$from=l+[1,1]);
>
> // builds a triangular mesh (itself a Tpatch) evaluating the Bezier Tpatch
> p
> // in a regular triangular grid of size n
> function Bezier_Tpatch_mesh(p,n) =
> let(degree=len(p)-1)
> [ for(i=[n:-1:0]) [ for(j=[n-i:-1:0])
> Bezier_Tpatch_eval(p,i/n,j/n,degree) ] ];
>
> // converts Tpatch tp to a polyhedron data [ vertices, tris ] format;
> // inv=true reverses the circulation order
> function Tpatch2polyhedron(tp, inv=false) =
> let( n = len(tp) != 0 ? len(tp) : 0,
> vertices = n == 0 ? [] : [ for(l=tp) for(pt=l) pt ],
> tris = concat( [ for(i=[0:n-2], j=[0:i], st=i*(i+1)/2 )
> inv ? [ st+j, st+i+j+2, st+i+1+j ]:
> [ st+j, st+i+1+j, st+i+j+2 ] ] ,
> [ for(i=[1:n-2], j=[0:i-1], st=i*(i+1)/2 )
> inv ? [ st+j, st+j+1, st+i+j+2 ] :
> [ st+j, st+i+j+2, st+j+1 ] ] ) )
> [ vertices, tris ];
>
>
> // converts a polygon poly to a polyhedron data [ vertices, tris ] format;
> // inv=true reverses the circulation order
> function polygon2polyhedron(poly, inv=false) =
> let( vertices = poly,
> range = inv ? [len(poly)-1: -1: 0] : [0:len(poly)-1],
> facets = [[for(i=range) i ]] )
> [ vertices, facets ];
>
> // generates a polyhedron with the surface of a Tpatch p with color c
> module show_Tpatch(p,c="yellow") {
> q = Tpatch2polyhedron(p);
> color(c) make_polyhedron([ q ]);
> }
>
> // generates one polyhedron composed by the polyhedron data in list polys
> module make_polyhedron(polys, convexity = 10) {
> function _accum_sum(l, offs=0, res=[0]) =
> len(res) == len(l) ?
> res :
> _accum_sum(l, offs+l[len(res)-1], concat(res, [
> offs+l[len(res)-1] ] ));
>
> vertlist = [for(p=polys, pt=p[0]) pt]; // collect all verts from
> polyhedra
> vertlens = [for(p=polys) len(p[0]) ]; // number of vertices of each
> polyhedron data
> acclens = _accum_sum(vertlens); // accumulated sum of the vertex set
> sizes to offset face indices
> facets = [ for(i=[0:len(polys)-1], f=polys[i][1] ) [ for(v=f)
> acclens[i]+v ] ];
>
> polyhedron(
> points = vertlist,
> faces = facets,
> convexity = convexity
> );
> }
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19309.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Tue, Nov 22, 2016 12:44 AM
@Rolnado, Thx you very very much. I'll take a deep look.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19314.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Rolnado, Thx you very very much. I'll take a deep look.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19314.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Tue, Nov 22, 2016 4:04 AM
@ Ronaldo: questions about the Bezier Triangular patch:
- how are the control points obtained ?
Consider you have a shape in mind that you want to present it with OpenSCAD.
How is the shape turned into the control points ?
- Is the control points the only thing the generate the whole shape ? My
study of your code so far seems to indicate that. That is, the 3 polys are
all generated from the control points ?
What's interesting is that I have a very similar approach to generate polys
from data sets. My data is like:
data=[ "name", "Part-A"
, "pts", [ P0,P1...]
, "faces", [... ]
, "ops", ops // operations
, "color", ["brown",1]
]
where ops= operations are something like:
[ "transl", [...], "rot", [...], "transl", [... ]]
The data can be treated with a function to "consume" all the ops to generate
the final points. Or, the data can be sent directly to a module called
/Makes( data_list )/ that will make a poly for each data.
One of the great things about this approach is that I can print out a BOM
automatically:
Part-A x2
Part-B x3
...
What haven't been achieved is the joinery between polys that is presented in
your approach.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19316.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@ Ronaldo: questions about the Bezier Triangular patch:
1) how are the control points obtained ?
Consider you have a shape in mind that you want to present it with OpenSCAD.
How is the shape turned into the control points ?
2) Is the control points the only thing the generate the whole shape ? My
study of your code so far seems to indicate that. That is, the 3 polys are
all generated from the control points ?
What's interesting is that I have a very similar approach to generate polys
from data sets. My data is like:
> data=[ "name", "Part-A"
> , "pts", [ P0,P1...]
> , "faces", [... ]
> , "ops", ops // operations
> , "color", ["brown",1]
> ]
where ops= operations are something like:
> [ "transl", [...], "rot", [...], "transl", [... ]]
The data can be treated with a function to "consume" all the ops to generate
the final points. Or, the data can be sent directly to a module called
/Makes( data_list )/ that will make a poly for each data.
One of the great things about this approach is that I can print out a BOM
automatically:
Part-A x2
Part-B x3
...
What haven't been achieved is the joinery between polys that is presented in
your approach.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19316.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Tue, Nov 22, 2016 1:09 PM
Well, that is a vast subject to be discussed here. I suggest you study some
on line texts on Bezier curve before reading about Bezier triangle patches.
I have just found this one https://pomax.github.io/bezierinfo/ .
Although I have not read it, it seems it covers the basic properties and
concepts. The next step is to understand how to build surfaces by tensor
product. I need to find a good reference for you. After that you will be
able to understand Bezier triangle surfaces.
runsun wrote
- how are the control points obtained ?
Control points are the coefficient of a polynomial. For a cubic curve, you
have 4 of them. For a biquadratic surface, you have 6. Either they are data
input or they are computed in order to get a specific polynomial (like, for
instance, in curve or surface fitting).
Consider you have a shape in mind that you want to present it with
OpenSCAD. How is the shape turned into the control points ?
That is the hard part. The Bezier control points of a curve or surface is a
coarse approximation of the curve segment or surface patch. In an
interactive environment, you change the position of the CPs and see the
result. In OpenSCAD, you need to change coordinates of the CPs and run the
code again. The CPs are a good indicator of the surface shape due to some
properties:
a) the curve segment or surface patch is in the convex hull of its CPs;
b) the curve segment or surface patch interpolates 2 (in case of curves), 3
(in case of Bezier triangles) or 4 (in case of rectangular Bezier patches)
of its CPs.
c) if you lift a CP, all the curve segment or surface patch lifts (except
for the interpolated points) but the lifting effect is greater near the
changed CP;
d) the curve segment or surface patch is tangent to segments or polygons
built from CPs near the interpolation points.
- Is the control points the only thing the generate the whole shape ? My
study of your code so far seems to indicate that. That is, the 3 polys are
all generated from the control points ?
Well, that is a vast subject to be discussed here. I suggest you study some
on line texts on Bezier curve before reading about Bezier triangle patches.
I have just found this one <https://pomax.github.io/bezierinfo/> .
Although I have not read it, it seems it covers the basic properties and
concepts. The next step is to understand how to build surfaces by tensor
product. I need to find a good reference for you. After that you will be
able to understand Bezier triangle surfaces.
runsun wrote
> 1) how are the control points obtained ?
Control points are the coefficient of a polynomial. For a cubic curve, you
have 4 of them. For a biquadratic surface, you have 6. Either they are data
input or they are computed in order to get a specific polynomial (like, for
instance, in curve or surface fitting).
> Consider you have a shape in mind that you want to present it with
> OpenSCAD. How is the shape turned into the control points ?
That is the hard part. The Bezier control points of a curve or surface is a
coarse approximation of the curve segment or surface patch. In an
interactive environment, you change the position of the CPs and see the
result. In OpenSCAD, you need to change coordinates of the CPs and run the
code again. The CPs are a good indicator of the surface shape due to some
properties:
a) the curve segment or surface patch is in the convex hull of its CPs;
b) the curve segment or surface patch interpolates 2 (in case of curves), 3
(in case of Bezier triangles) or 4 (in case of rectangular Bezier patches)
of its CPs.
c) if you lift a CP, all the curve segment or surface patch lifts (except
for the interpolated points) but the lifting effect is greater near the
changed CP;
d) the curve segment or surface patch is tangent to segments or polygons
built from CPs near the interpolation points.
> 2) Is the control points the only thing the generate the whole shape ? My
> study of your code so far seems to indicate that. That is, the 3 polys are
> all generated from the control points ?
Yes, if you have the coefficients of a polynomial it is fully determined.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19318.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Tue, Nov 22, 2016 6:02 PM
Thx, Ronaldo. The ref you gave is a great resource.
Will need to get myself familiar with the way a surface be made with CPs.
I'm to some extent quite familiar with Bezier curve:
http://forum.openscad.org/file/n19325/16bm_scadx_demo_smoothPts_demo.png
But those were done with existing points, on which the CPs are made. So it
will take some digging to get to know how the CPs could come first (i.e.,
w/o points of the surface to start with) in the Bezier surface.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19325.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thx, Ronaldo. The ref you gave is a great resource.
Will need to get myself familiar with the way a surface be made with CPs.
I'm to some extent quite familiar with Bezier curve:
<http://forum.openscad.org/file/n19325/16bm_scadx_demo_smoothPts_demo.png>
But those were done with existing points, on which the CPs are made. So it
will take some digging to get to know how the CPs could come first (i.e.,
w/o points of the surface to start with) in the Bezier surface.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19325.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Tue, Nov 22, 2016 6:17 PM
runsun, the figure you have appended shows a curve interpolating to all
given data points and not a Bezier curve. In fact, I suspect that your
interpolation is made of a set of polynomial curves (a natural spline?) and
not just one polynomial curve as Bezier curves. Bezier curves are
different: they interpolates just the first and last control points and
they are in the convex hull of its control points. In some sense, those
properties are true for Bezier surfaces too. Interpolation techniques have
their value in modelling but its natural "instability" sometimes surprises.
2016-11-22 16:02 GMT-02:00 runsun runsun@gmail.com:
runsun, the figure you have appended shows a curve interpolating to all
given data points and not a Bezier curve. In fact, I suspect that your
interpolation is made of a set of polynomial curves (a natural spline?) and
not just one polynomial curve as Bezier curves. Bezier curves are
different: they interpolates just the first and last control points and
they are in the convex hull of its control points. In some sense, those
properties are true for Bezier surfaces too. Interpolation techniques have
their value in modelling but its natural "instability" sometimes surprises.
2016-11-22 16:02 GMT-02:00 runsun <runsun@gmail.com>:
> Will need to get myself familiar with the way a surface be made with CPs.
> I'm to some extent quite familiar with Bezier curve:
>
> <http://forum.openscad.org/file/n19325/16bm_scadx_demo_smoothPts_demo.png>
>
R
runsun
Tue, Nov 22, 2016 6:39 PM
Bezier curves are different: they interpolates just the first and last
control points and
they are in the convex hull of its control points.
In that case, I must have applied the Bezier in a wrong way. These curves
are indeed built with Bezier approach, but I applied it pair-wise (each pair
generates 4 CPs), so points between each pair are Bezier points.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19327.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ronaldo wrote
> Bezier curves are different: they interpolates just the first and last
> control points and
> they are in the convex hull of its control points.
In that case, I must have applied the Bezier in a wrong way. These curves
are indeed built with Bezier approach, but I applied it pair-wise (each pair
generates 4 CPs), so points between each pair are Bezier points.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19327.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Tue, Nov 22, 2016 7:11 PM
In that case, I must have applied the Bezier in a wrong way. These curves
are indeed built with Bezier approach, but I applied it pair-wise (each
pair
generates 4 CPs), so points between each pair are Bezier points.
Ok, I see what you have done, you did right. It is a C1 interpolation
spline, sometimes called Hermite spline. You possibly estimates the
tangents at the points and find the Bezier CPs of each polynomial arc based
on the tangents and the extremes points of the arc. But then, the BezierCPs
are not all interpolated and two of them for each arc control the starting
end ending arc tangent. The same happens with Bezier CPs of surfaces: some
CPs are interpolated and the others control its partial derivatives.
2016-11-22 16:39 GMT-02:00 runsun <runsun@gmail.com>:
> In that case, I must have applied the Bezier in a wrong way. These curves
> are indeed built with Bezier approach, but I applied it pair-wise (each
> pair
> generates 4 CPs), so points between each pair are Bezier points.
>
> Ok, I see what you have done, you did right. It is a C1 interpolation
spline, sometimes called Hermite spline. You possibly estimates the
tangents at the points and find the Bezier CPs of each polynomial arc based
on the tangents and the extremes points of the arc. But then, the BezierCPs
are not all interpolated and two of them for each arc control the starting
end ending arc tangent. The same happens with Bezier CPs of surfaces: some
CPs are interpolated and the others control its partial derivatives.
R
Ronaldo
Tue, Nov 22, 2016 8:39 PM
runsun,
Perhaps, the following code may help you to understand the relationship
between the CPs and the Bezier triangle surface. You don't need to
understand all the code. Run it, change the first two or three parameters
and examine the results.
use
<Bezier_triangles.scad>
// this should be the previous code defining Tpatches
a = 45; // change freely this two parameters
b = 30; // this is a z scale
degree = 3; // and the polynomial degree up to 6
size = 50; // of the base triangle
// base triangle vertices
base_tri = size*[ [1,0], [-1/2,sqrt(3)/2], [-1/2,-sqrt(3)/2] ];
// control points of a zero polynomial
bcps = [ for(i=[degree:-1:0]) [for(j=[0:degree-i]) base_tri[0]*i/degree +
base_tri[1]j/degree +base_tri[2](degree-i-j)/degree ] ];
// Z values to be added to bcps
zvals = [ for(i=[5:(degree+2)(degree+1)/2+10]) b(sin(i*a)+2) ];
// the final control points
cps = [for(i=[0:degree]) [for(j=[0:i]) [bcps[i][j][0], bcps[i][j][1],
zvals[i+(i-1)*i/2+j] ] ] ];
Tpatch_grid(bcps);
color("blue") Tpatch_grid(cps);
show_Tpatch(Bezier_Tpatch_mesh(cps, 10),c="red");
color("red") Tpatch_grid(Bezier_Tpatch_mesh(cps, 10),t=0.7);
module Tpatch_grid(tp, t=1) {
n = len(tp);
if (n>1) {
for(i=[1:n-1]) polyline(tp[i],t=t);
for(i=[1:n-1]) polyline([for(j=[0:i]) tp[n-j-1][i-j] ],t=t);
for(j=[0:n-2]) polyline([for(i=[j:n-1]) tp[i][j] ],t=t);
}
}
module polyline(pts, t=1, closed=false) {
if(len(pts)>1 && len(pts[0])>1 && t>0) {
p = concat([for(ptsi=pts) project_to_3D(ptsi)],
closed? [project_to_3D(pts[0])] : []);
for(i=[0:len(p)-2]) {
v = p[i+1]-p[i];
h = norm(v);
if( h > 1e-12)
translate(p[i])
rotate([0, acos(v[2]/h), atan2(v[1],v[0])])
rotate(45) cylinder(h=h, d=t, $fn=4);
}
}
}
function project_to_3D(p) =
len(p)>=3? [p[0], p[1], p[2]] : len(p)==2 ? [p[0], p[1], 0] : [];
runsun,
Perhaps, the following code may help you to understand the relationship
between the CPs and the Bezier triangle surface. You don't need to
understand all the code. Run it, change the first two or three parameters
and examine the results.
> use
> <Bezier_triangles.scad>
> // this should be the previous code defining Tpatches
>
> a = 45; // change freely this two parameters
> b = 30; // this is a z scale
> degree = 3; // and the polynomial degree up to 6
> size = 50; // of the base triangle
>
> // base triangle vertices
> base_tri = size*[ [1,0], [-1/2,sqrt(3)/2], [-1/2,-sqrt(3)/2] ];
> // control points of a zero polynomial
> bcps = [ for(i=[degree:-1:0]) [for(j=[0:degree-i]) base_tri[0]*i/degree +
> base_tri[1]*j/degree +base_tri[2]*(degree-i-j)/degree ] ];
>
> // Z values to be added to bcps
> zvals = [ for(i=[5:(degree+2)*(degree+1)/2+10]) b*(sin(i*a)+2) ];
> // the final control points
> cps = [for(i=[0:degree]) [for(j=[0:i]) [bcps[i][j][0], bcps[i][j][1],
> zvals[i+(i-1)*i/2+j] ] ] ];
>
> Tpatch_grid(bcps);
> color("blue") Tpatch_grid(cps);
> show_Tpatch(Bezier_Tpatch_mesh(cps, 10),c="red");
> color("red") Tpatch_grid(Bezier_Tpatch_mesh(cps, 10),t=0.7);
>
> module Tpatch_grid(tp, t=1) {
> n = len(tp);
> if (n>1) {
> for(i=[1:n-1]) polyline(tp[i],t=t);
> for(i=[1:n-1]) polyline([for(j=[0:i]) tp[n-j-1][i-j] ],t=t);
> for(j=[0:n-2]) polyline([for(i=[j:n-1]) tp[i][j] ],t=t);
> }
> }
>
> module polyline(pts, t=1, closed=false) {
> if(len(pts)>1 && len(pts[0])>1 && t>0) {
> p = concat([for(ptsi=pts) project_to_3D(ptsi)],
> closed? [project_to_3D(pts[0])] : []);
> for(i=[0:len(p)-2]) {
> v = p[i+1]-p[i];
> h = norm(v);
> if( h > 1e-12)
> translate(p[i])
> rotate([0, acos(v[2]/h), atan2(v[1],v[0])])
> rotate(45) cylinder(h=h, d=t, $fn=4);
> }
> }
> }
>
> function project_to_3D(p) =
> len(p)>=3? [p[0], p[1], p[2]] : len(p)==2 ? [p[0], p[1], 0] : [];
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19330.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Thu, Nov 24, 2016 12:43 AM
@ Ronaldo, Wow, this is cool. Thx man.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19347.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@ Ronaldo, Wow, this is cool. Thx man.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19347.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Thu, Nov 24, 2016 12:49 AM
Looking at the result shapes, I now understand how the Bezier Triangle Patch
manages to go from CPs to poly.
I guess it's a method to "generate a new surface", which is different from
"smoothing existing surface" that I originally imagined.
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19348.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Looking at the result shapes, I now understand how the Bezier Triangle Patch
manages to go from CPs to poly.
I guess it's a method to "generate a new surface", which is different from
"smoothing existing surface" that I originally imagined.
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19348.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Thu, Nov 24, 2016 4:12 AM
2016-11-23 22:49 GMT-02:00 runsun
<
runsun@gmail.com
>
:
I guess it's a method to "generate a new surface", which is different
from
"smoothing existing surface" that I originally imagined.
From left to right, the first figure shows the CPs (red marks) of a
quadratic arc: it has one corner point. In the second, we cut the corner
point out through the median points of the two edges and get 2 new green
corners. In the next one, we cut the two new corners by the same process and
get 4 new green corners. If we iterate indefinitely this process of cutting
corners, we will get a smooth curve (the blue one): a parabola! Note that
the median point of each new edge resulting from the corner cut (the blue
marks) is a point of the final parabola. The corner cutting method is a
smoothing process.
It is not what you originally imagined because it is not an interpolation
process. However, interpolation methods sometimes produce unexpected
oscillations, that is a waving behavior we don't see in the data points.
Even natural spline interpolation method is unstable. On the other hand,
Bezier and B-spline methods are not interpolations of their CPs but have no
more "oscillations" than their CPs. In CADGD, the Bezier and B-spline
representations are invaluable when we understand well the relationship
between the shapes and their CPs and realize why CPs are called as such.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19354.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
> 2016-11-23 22:49 GMT-02:00 runsun
> <
> runsun@gmail.com
> >
> :
> I guess it's a method to "generate a new surface", which is different
> from
> "smoothing existing surface" that I originally imagined.
In some sense, Bezier curves and surfaces are a smoothing process of the
control points. Look at the following sequence of operations behind a Bezier
quadratic:
<http://forum.openscad.org/file/n19354/Bez_subdivision.png>
>From left to right, the first figure shows the CPs (red marks) of a
quadratic arc: it has one corner point. In the second, we cut the corner
point out through the median points of the two edges and get 2 new green
corners. In the next one, we cut the two new corners by the same process and
get 4 new green corners. If we iterate indefinitely this process of cutting
corners, we will get a smooth curve (the blue one): a parabola! Note that
the median point of each new edge resulting from the corner cut (the blue
marks) is a point of the final parabola. The corner cutting method is a
smoothing process.
It is not what you originally imagined because it is not an interpolation
process. However, interpolation methods sometimes produce unexpected
oscillations, that is a waving behavior we don't see in the data points.
Even natural spline interpolation method is unstable. On the other hand,
Bezier and B-spline methods are not interpolations of their CPs but have no
more "oscillations" than their CPs. In CADGD, the Bezier and B-spline
representations are invaluable when we understand well the relationship
between the shapes and their CPs and realize why CPs are called as such.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19354.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Thu, Nov 24, 2016 2:07 PM
Thanks Ronaldo,
nice example. To cherish stuff like that an image of what the code produces
is invaluable:
http://forum.openscad.org/file/n19356/Unbenannt.png
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19356.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thanks Ronaldo,
nice example. To cherish stuff like that an image of what the code produces
is invaluable:
<http://forum.openscad.org/file/n19356/Unbenannt.png>
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19356.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Nov 28, 2016 7:49 PM
I have found a family of methods appropriated to build organic shapes. They
are called subdivision algorithms and are founded in the subdivision methods
usual to Bezier and B-spline curve and surfaces. They may be regarded as a
generalization of the corner cutting method I illustrated in my previous
message.
Imagine you start with a cube. As a first step, we cut out each vertex of
the cube by a plane through its incident edges. Twenty four new vertices now
substitute the initial twelve and eighth new facets are added. Now, apply
the same procedure (vertex cuts) to the resulting polyhedron again and
again. The polyhedron facet number will grow exponentially and the
polyhedron surface may converge to a smooth surface depending on the chosen
cuts.
The methods I have found are different from that in the way they cut the
vertices but that is the general idea behind them. The methods are very
simple and could be well implemented in OpenSCAD if we had more powerful
means to build data structures. The iteration steps of the method require
that the polyhedron definition be refined.
I have started to write a triangulation data structure in OpenSCAD. But it
is very hard to do it with just lists and even harder to debug it.
Here are some references of papers on the subdivision methods:
Interpolating Nets Of Curves By Smooth Subdivision Surface
https://pdfs.semanticscholar.org/ab8d/1d77586beeedcb8808a21fb25cd0e2771a2a.pdf
Interpolatory sqrt(3)-subdivision
https://www.google.com.br/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwiSoOD7mczQAhVBgpAKHUzLCzMQFggmMAE&url=http%3A%2F%2Fwww.uni-weimar.de%2F~caw%2Fpapers%2Fgreiner.pdf&usg=AFQjCNE-OqH_GOxWnHqo1uAdI1dS8x7uiw&sig2=z4lHuTty2O0MgmogO-plIw&bvm=bv.139782543,d.Y2I
sqrt(3)-subdivision
https://www.google.com.br/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiA94aZmszQAhUBjZAKHZnRBuIQFggbMAA&url=https%3A%2F%2Fwww.graphics.rwth-aachen.de%2Fmedia%2Fpapers%2Fsqrt31.pdf&usg=AFQjCNEuF9Yzqs9sJ3EqFO5pO0-j3WJ38A&sig2=y5GcfkkyMEIx57EdqE89pg&bvm=bv.139782543,d.Y2I
The first reference have nice figures showing how promising is the method
for organic modelling.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19390.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I have found a family of methods appropriated to build organic shapes. They
are called subdivision algorithms and are founded in the subdivision methods
usual to Bezier and B-spline curve and surfaces. They may be regarded as a
generalization of the corner cutting method I illustrated in my previous
message.
Imagine you start with a cube. As a first step, we cut out each vertex of
the cube by a plane through its incident edges. Twenty four new vertices now
substitute the initial twelve and eighth new facets are added. Now, apply
the same procedure (vertex cuts) to the resulting polyhedron again and
again. The polyhedron facet number will grow exponentially and the
polyhedron surface may converge to a smooth surface depending on the chosen
cuts.
The methods I have found are different from that in the way they cut the
vertices but that is the general idea behind them. The methods are very
simple and could be well implemented in OpenSCAD if we had more powerful
means to build data structures. The iteration steps of the method require
that the polyhedron definition be refined.
I have started to write a triangulation data structure in OpenSCAD. But it
is very hard to do it with just lists and even harder to debug it.
Here are some references of papers on the subdivision methods:
Interpolating Nets Of Curves By Smooth Subdivision Surface
<https://pdfs.semanticscholar.org/ab8d/1d77586beeedcb8808a21fb25cd0e2771a2a.pdf>
Interpolatory sqrt(3)-subdivision
<https://www.google.com.br/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&uact=8&ved=0ahUKEwiSoOD7mczQAhVBgpAKHUzLCzMQFggmMAE&url=http%3A%2F%2Fwww.uni-weimar.de%2F~caw%2Fpapers%2Fgreiner.pdf&usg=AFQjCNE-OqH_GOxWnHqo1uAdI1dS8x7uiw&sig2=z4lHuTty2O0MgmogO-plIw&bvm=bv.139782543,d.Y2I>
sqrt(3)-subdivision
<https://www.google.com.br/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiA94aZmszQAhUBjZAKHZnRBuIQFggbMAA&url=https%3A%2F%2Fwww.graphics.rwth-aachen.de%2Fmedia%2Fpapers%2Fsqrt31.pdf&usg=AFQjCNEuF9Yzqs9sJ3EqFO5pO0-j3WJ38A&sig2=y5GcfkkyMEIx57EdqE89pg&bvm=bv.139782543,d.Y2I>
The first reference have nice figures showing how promising is the method
for organic modelling.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19390.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Mon, Nov 28, 2016 9:24 PM
@Ronaldo, Thx for the precious references.
Btw, I saw you mentioned data structure in several posts. What do you have
in mind ?
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19393.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@Ronaldo, Thx for the precious references.
Btw, I saw you mentioned data structure in several posts. What do you have
in mind ?
-----
$ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), synwrite ( 2 ); $ tips: Bezier , 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 , triang , unit ; $ Apps: rollApp , blockscad , openjscad , on AWS ( pdf )
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19393.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Mon, Nov 28, 2016 10:00 PM
@ronaldo - don't forget the doo-sabin resmooth operator which is very
useful.
It can be easily seen in Wings3D under the Bodies menu. Where you can also
compare it to the regular smooth algorithm.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19396.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
@ronaldo - don't forget the doo-sabin resmooth operator which is very
useful.
It can be easily seen in Wings3D under the Bodies menu. Where you can also
compare it to the regular smooth algorithm.
--
View this message in context: http://forum.openscad.org/Can-you-sweep-a-object-with-fingers-tp19057p19396.html
Sent from the OpenSCAD mailing list archive at Nabble.com.