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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
Yes, I aware of it. It causes no harm as discussed before. I explore that in my codes. 20161119 20:13 GMT02:00 runsun <[hidden email]>: Ronaldo wrote _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
I am not sure I have understood your understanding.
20161119 22:40 GMT02:00 runsun <[hidden email]>: Thx, Ronaldo. The understanding of no need to be exact same number of points _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
@Ronaldo: I think I didn't think through it clearly. You are right to point that out.
What interests me is the resampling process to match two surfaces. I'd be interested how you achieved that as in the following fig: Or how Parkinrob achieves his: 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 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 resampling: It is still far from "irregular hole", but already can do lots of cool stuff.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
runsun, the resampling 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 ascendingordered 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: 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 resample 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 resampling. Anyway, I have a clearer and commented implementation of the method if you need it. 
@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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
20161120 14:55 GMT02:00 runsun <[hidden email]>: @Ronaldo, ah ha ! The moment I spotted your figure, I see how you did it 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. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
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 pointinsertion, 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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
In reply to this post by Ronaldo
I found a first simple scheme to make a furcation:
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 CloughTocher 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. 
Correction: the surface is composed of three rectangular and two triangular patches. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
In reply to this post by Ronaldo
@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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
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. 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 nfurcation so to speak: given n mouths it computes the nfurcation. Using the scheme I sketched, in a 5furcation, 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. 
@Ronaldo, That's good enough for me for now. Thx for the explanation.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
Any way, if someone wants to play with triangular patches here are my codes to start with:

@Rolnado, Thx you very very much. I'll take a deep look.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
In reply to this post by Ronaldo
@ 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: where ops= operations are something like: 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: PartA x2 PartB x3 ... What haven't been achieved is the joinery between polys that is presented in your approach.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
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. 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.
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). 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. Yes, if you have the coefficients of a polynomial it is fully determined. 
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: 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: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets 
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.
20161122 16:02 GMT02:00 runsun <[hidden email]>: Will need to get myself familiar with the way a surface be made with CPs. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org 
Free forum by Nabble  Edit this page 