Wings 3D Development Forum
Request for automatic handle - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: ManifoldLab Plug-ins Collection (https://www.wings3d.com/forum/forumdisplay.php?fid=14)
+--- Thread: Request for automatic handle (/showthread.php?tid=1556)

Pages: 1 2


Request for automatic handle - cyseal - 02-01-2016

Micheus and Fonte Boa explained here how to make a sweep with some number of cuts.
http://www.wings3d.com/forum/showthread.php?tid=1541

Could you implement automatic sweep?

It would connect 2 faces with some number of extruded cuts with the option that faces could be rotated (with a twist).

Similar to handle algorithm in TopMod.


RE: Request for automatic handle - ggaliens - 02-03-2016

I love doing things in "baby steps". Maybe step 1 like ...

Place a torus arc between two faces using the N-RING with N-EDGES ... which would be the average of edges in source face + dest face . IE if one face had 5 and the other 7 ... you would get a hexagonal extrusion placed for free. Welding/Bridging would then be your responsibility.


RE: Request for automatic handle - ggaliens - 02-04-2016

Today I started implementing cardinal splines ... by porting some python to Erlang. Cardinal splines track through points to make a somewhat smooth curve. There is a chance it would make a cool stand-in basis function for HANDLES. We shall see. I guess the proof will be in the eating of the pudding.

The tubes I have to date are "Control point" based and the points used to make the curve are "off curve" and only near curve if the control points are dense. So ... cardinal splines are new and interesting. I think thet are less awesome than say Catmull ROM. Need to try more spline applets.


RE: Request for automatic handle - ggaliens - 02-04-2016

Also ... been thinking that one possible easy way to do handles would be to use "Sweep along rails" ... which is a really old Rhino3d concept. Think of it as inner and outer handles (rails) and one of the two faces is extruded out along the matching (eminating) rails. Until it get to point where rails penetrate the other face.


RE: Request for automatic handle - ggaliens - 02-04-2016

Micheus ... this is a test REPLY.

Not working correct yet. Padding at ends logic needs help. And Polykind parameter must get used.

Code:
%% http://stackoverflow.com/questions/7054272/how-to-draw-smooth-curve-through-n-points-using-javascript-html5-canvas
%% TEST : cardinal_spline([0.0,0.0,  1.0,0.0,  1.0,1.0,  0.0,0.0], 12)
cardinal_spline(PTS, PolyKind, NumOfSegments) when is_integer(NumOfSegments)
    when PolyKind == polyline orelse PolyKind == polygon ->
    Tension = 0.7,
    Len = length(PTS),
    _Pts = fun(I0) ->
        I = I0 + Len,
        lists:nth((I rem Len) + 1,PTS)
    end,
    Fun = fun
        (I, Acc) ->
            Fun1 = fun(T, Acc1) ->
                %% calc tension vectors

                T1X = (element(1,_Pts(I+1)) - element(1,_Pts(I-1))) * Tension,
                T2X = (element(1,_Pts(I+2)) - element(1,_Pts(I))) * Tension,

                T1Y = (element(2,_Pts(I+1)) - element(2,_Pts(I-1))) * Tension,
                T2Y = (element(2,_Pts(I+2)) - element(2,_Pts(I))) * Tension,

                T1Z = (element(3,_Pts(I+1)) - element(3,_Pts(I-1))) * Tension,
                T2Z = (element(3,_Pts(I+2)) - element(3,_Pts(I))) * Tension,

                %% calc step
                ST = 1.0 * T / NumOfSegments,
                %% calc cardinals
                C1 =   2.0 * pow(ST,3.0)  - 3.0 * pow(ST,2.0) + 1.0,
                C2 = -(2.0 * pow(ST,3.0)) + 3.0 * pow(ST,2.0),
                C3 =         pow(ST,3.0)  - 2.0 * pow(ST,2.0) + ST,
                C4 =         pow(ST,3.0)  -       pow(ST,2.0),

                %% calc x and y cords with common control vectors
                X = C1 * element(1,_Pts(I))  + C2 * element(1,_Pts(I+1)) + C3 * T1X + C4 * T2X,
                Y = C1 * element(2,_Pts(I))  + C2 * element(2,_Pts(I+1)) + C3 * T1Y + C4 * T2Y,
                Z = C1 * element(3,_Pts(I))  + C2 * element(3,_Pts(I+1)) + C3 * T1Z + C4 * T2Z,

                [{X,Y,Z}|Acc1]

            end,
            lists:foldl(Fun1, Acc, lists:seq(0,NumOfSegments-1))
    end,
    lists:foldl(Fun, [], lists:seq(1,length(PTS)-0)).






RE: Request for automatic handle - cyseal - 02-04-2016

Great work!
I'm impressed with torus handles.


RE: Request for automatic handle - ggaliens - 02-04-2016

After reading the PLAIN-TEXT comments about how the POINTS array for cardinal-spline was to be "buffered" for closed vs open. I was able to FIX the behavior to what would be expected for closed vs Open.

So the idea would be to have some templates that would go from plain old arc to say maybe exercise "kettle-bell" handle or an iron handle and pick the one that is more appropriate for the situation. Cyseal ... I noticed that your TOP mode did export some handles that were not ARCS.


RE: Request for automatic handle - micheus - 02-04-2016

That's nice.
So, soon we could have two different ways to try produce that kind of handle.
I have been working on something since that day, because it's something I was looking for long time - when I lose my curve code.

It will not be so advanced but should help in the basic needs.
I'm trying to reuse codes already available (exported) as many as possible and it take me time to search and understand them. Unfortunately I have just a few hours a week. So, I do that in ant steps. Smile


RE: Request for automatic handle - ggaliens - 02-04-2016

Someone here should TRY the demo I made with ball and grid shown above. Why not. If you use a lot of point with cardinal spline ... it gets weird and curve gets "dented" and stuff. But if you use less ... the behavior is nice and interesting. New RELEASE with better Cardinal curves a few minutes ago.


RE: Request for automatic handle - cyseal - 02-05-2016

ggaliens,
I'll remake them and I'll send them to you. I think I used two "crust" algorithms in TopMod. It basically splits one handle in two handles but also changes the overall geometry (adds some volume to it). I'll make them without it as soon as I come home from work.
Can I post it here so that anybody could join discussion about handlebody ?
___________________________________________________________________________________________
So the idea would be to have some templates that would go from plain old arc to say maybe exercise "kettle-bell" handle or an iron handle and pick the one that is more appropriate for the situation. Cyseal ... I noticed that your TOP mode did export some handles that were not ARCS.