postspectacular / toxiclibs

Official master repo (Git version)
http://toxiclibs.org
GNU Lesser General Public License v2.1
183 stars 44 forks source link

Using the BasicNurbsSurface class #7

Open co-ord opened 5 years ago

co-ord commented 5 years ago

Dear toxi,

I'd like to use the BasicNurbsSurface class but haven't found a single example sketch on the web and it seems the corresponding Javadoc is missing.

Would you mind sharing a very basic example sketch demonstrating how to handle a nurb surface with toxiclibs ?

Respectfully,

solub

co-ord commented 5 years ago

@postspectacular Pardon my insistence, I've looked and asked almost everywhere about this but to no avail. I would be immensely grateful if you could provide a minimal example showing how to use a NurbsSurface with toxiclibs.

postspectacular commented 5 years ago

Few days ago I've been looking through some of my backups, but still haven't found a small enough example to share. Will have another look tomorrow... Btw. to give you an idea of some basic possibilities, see: https://www.flickr.com/photos/toxi/tags/nurbs

co-ord commented 5 years ago

These nurbs are beautiful Karsten ! I wouldn't mind a more complex example, anything would be fine really.

co-ord commented 5 years ago

@postspectacular Could you at least please tell me how to instantiate the NurbsSurface class ? Just a snippet of any of your examples would be fine. Please !

postspectacular commented 5 years ago

I'm sorry this is taking so long, but please understand that it's not as straightforward for me to dig out and through backed up projects from 10 years ago, nor is this a high priority from my side... In the meantime do have a look at the dozen or so static methods in the NurbsCreator class:

Once you have a NurbsSurface instance built, you can then pass it to the NurbsMeshCreator to convert the surface to triangle mesh with customizable resolution:

https://github.com/postspectacular/toxiclibs/blob/master/src.core/toxi/geom/nurbs/NurbsMeshCreator.java

The difference between createControlMesh() and createMesh() is that the former constructs a mesh from the surface's control points, whereas the latter performs the full nurbs interpolation and results in a smooth surface representation (depending on chosen resolution)...

co-ord commented 5 years ago

Thank you Karsten. I'll have a look at it and will try to post a basic example here for future users.