Radial Nurbs

Show off your FreeCAD projects here!
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Radial Nurbs

Postby looo » Tue Feb 02, 2016 5:58 pm

Reading about mesh-less fem and radial base function mixing with T-splines leads to this: https://vimeo.com/153939513
No exact geometry is possible with this, but it can be used very flexible. The grid does not have to be quads, triangles... But not useful at all :D
please help with my conda-packaging efforts: https://liberapay.com/looooo/
emills2
Posts: 577
Joined: Tue Apr 28, 2015 11:23 pm

Re: Radial Nurbs

Postby emills2 » Tue Feb 02, 2016 6:19 pm

i would think exact geometry is very possible with this, just hard to constrain. Do you plan to pin down the knot vector for the edges?
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: Radial Nurbs

Postby looo » Tue Feb 02, 2016 7:50 pm

The pinning is one problem. Because the basis funcions are radial and not uv the boarder in the "basis plane" can't be straight to get a straight edge in the mapped plane.
Closed bodies should work and the topology could be as complex as with t-splines. The problem is that cylindrical faces, straight lines ... are difficult to build. Maybe it could be used as a tool for sculpting.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
emills2
Posts: 577
Joined: Tue Apr 28, 2015 11:23 pm

Re: Radial Nurbs

Postby emills2 » Wed Feb 03, 2016 6:58 am

sounds fun! too much fun for me though :D are you sure there is no mapping to normal basis functions for th edges? that would be really sweet.
triplus
Posts: 8706
Joined: Mon Dec 12, 2011 4:45 pm

Re: Radial Nurbs

Postby triplus » Wed Feb 03, 2016 9:58 am

Looking good.

If i remember correctly not that long ago one user was asking if FreeCAD would allow him to do sculptures. Tools like seen on the video would be ideal for this task.
User avatar
Chris_G
Posts: 1139
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Radial Nurbs

Postby Chris_G » Thu Feb 04, 2016 9:50 am

Hi looo,
Wow, how I would love to see that kind of freehand Pole Editing behaviour implemented into FreeCAD curves and surfaces.
Congratulations, it looks great !
Yesterday, I started to give a try at creating a grabbing manipulator, like in Blender, in order to edit curve poles.
Would you share your python script, please ? ( mouse events and coin are such a pain for me ! )
Chris
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: Radial Nurbs

Postby looo » Thu Feb 04, 2016 12:40 pm

Yesterday, I started to give a try at creating a grabbing manipulator, like in Blender, in order to edit curve poles.
Would you share your python script, please ? ( mouse events and coin are such a pain for me ! )
My goal was also to make something similar to blender. ("g" is grab, "x" is delete, "shift" is precise drag)
I have tried this 3 times now and I am still not happy with it. https://github.com/looooo/freecad_glide ... new_new.py

For dragging Markers and Containers are used. The container store all the markers and does all the interactive stuff. There are better methods for the selection available from coin, but I haven't understood this fully.

Code: Select all

marker = Marker([[0,0,0]], dynamic=True)
cpc = Container()    # control point container
cpc.addChild(marker)
view = Gui.ActiveDocument.ActiveView
view.getSceneGraph().addChild(cpc)
cpc.register(Gui.ActiveDocument.ActiveView)
callbacks can be added with:

Code: Select all

cpc.on_drag.append(function)
cpc.on_drag_release.append(function)
cpc.on_drag_start.append(function)
to disable all interactive stuff do:

Code: Select all

cpc.unregister()
The other stuff shown in the video is really simple. I used Eigen matrices wrapped to python to get a fast sparse matrix product. and a coin.SoMesh to display the result.
are you sure there is no mapping to normal basis functions for th edges? that would be really sweet.
I have no idea for this, but maybe it is possible. The next thing I would like to try is the mapping of a 3d spher-surface to a closed body. Using spherical basis function on a sphere :D
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
Chris_G
Posts: 1139
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Radial Nurbs

Postby Chris_G » Thu Feb 04, 2016 4:30 pm

Thanks looo,
That's very interesting.
I think I barely understand how it works.
I will try to use it on a bezier curve edit tool ( and maybe also try to add Blender's X Y and Z axis constraints, as an exercise, to dig in the code ).
Thanks a lot.
Chris
looo
Posts: 2894
Joined: Mon Nov 11, 2013 5:29 pm

Re: Radial Nurbs

Postby looo » Thu Feb 04, 2016 7:28 pm

callbacks can be added with:

Code: Select all

 Select all
cpc.on_drag.append(function)
cpc.on_drag_release.append(function)
cpc.on_drag_start.append(function)
Sorry this wasn't true. But I have added this now. You can add function which should be called during draging directly to the container or you can add them to the markers.

For the x, y, z dragging you will have to change the way how the new position is calculated. Right now for every step there is calculated a diff vector from the previous mouse position to the current mouse position. If you want the same behaviour like blender, pressing x should bring the moved point to a position on the x-line which starts at the old position when the drag was started. Otherwise the dragging is constrained to the current position of the marker.

I have tried some stuff and it should work this way: https://github.com/looooo/freecad_glide ... 033c07bd5b
I will try to use it on a bezier curve edit tool ( and maybe also try to add Blender's X Y and Z axis constraints, as an exercise, to dig in the code ).
Maybe you can try to add also the xy, xz, yz stuff to constrain to a plane.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
Chris_G
Posts: 1139
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Radial Nurbs

Postby Chris_G » Thu Feb 04, 2016 10:06 pm

Hi looo,
Sorry this wasn't true.
Yes, I saw. Not that important.
I mainly read the code and tried to understand how it works. Quite a challenge for me.
For the x, y, z dragging you will have to change the way how the new position is calculated. Right now for every step there is calculated a diff vector from the previous mouse position to the current mouse position. If you want the same behaviour like blender, pressing x should bring the moved point to a position on the x-line which starts at the old position when the drag was started. Otherwise the dragging is constrained to the current position of the marker.
OK, I noticed that also.
I have tried some stuff and it should work this way: https://github.com/looooo/freecad_glide ... 033c07bd5b
I will look at it. You are a much more advanced coder than I am. What seems to take you minutes to code, would take me hours ...
So ... I learn. And your code is very instructive.
Maybe you can try to add also the xy, xz, yz stuff to constrain to a plane.
Another blender feature ? I didn't know it ...
Thanks again.
Chris