# NURBS surface with Toxiclibs

**URL:** <https://discourse.processing.org/t/nurbs-surface-with-toxiclibs/7747>\
**Category:** Libraries\
**Created:** [January 22, 2019, 7:28pm UTC](https://discourse.processing.org/t/nurbs-surface-with-toxiclibs/7747 "2019-01-22T19:28:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [January 22, 2019, 7:28pm UTC](https://discourse.processing.org/t/nurbs-surface-with-toxiclibs/7747/1 "2019-01-22T19:28:37Z")

</div>

Hi all,

I’m desperately trying to create a nurbs surface using the toxiclibs library.

Because of the missing Java doc and also because of the complete lack of related example on the web I contacted Karsten Schmidt about a month ago and asked him if he could provide a simple working example.

He recently replied he didnt have much time to dig through his old projects but provided the following details as a form of guidance:

> Have a look at the dozen or so **static methods** in the `NurbsCreator` class:
> 
> - [**2D**](https://github.com/postspectacular/toxiclibs/blob/master/src.core/toxi/geom/nurbs/NurbsCreator.java#L76)
> - [**3D**](https://github.com/postspectacular/toxiclibs/blob/master/src.core/toxi/geom/nurbs/NurbsCreator.java#L253)
> 
> 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:
> 
> [toxiclibs/src.core/toxi/geom/nurbs/NurbsMeshCreator.java at master · postspectacular/toxiclibs · GitHub](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)…

I spent hours since then trying to figure out how to build a simple `NurbsSurface` instance but without success. I am so confused about this that I can’t even provide here a single snippet of code.

I would therefore be immensely grateful if someone could help me understanding at least how to deal with the static methods submited by Karsten.

Again, my apologies for the lack of code, I’m really at a loss about how to tackle that issue.

 ![](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/52b2d50c2acc3b621ca67c59db092e8e443caee4.png)

_an example of a NURBS surface created with Toxiclibs (see [gallery](https://www.flickr.com/photos/toxi/tags/nurbs) here)_

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [January 28, 2019, 12:08am UTC](https://discourse.processing.org/t/nurbs-surface-with-toxiclibs/7747/2 "2019-01-28T00:08:11Z")

</div>

@solub – am I right that you are trying to achieve a 3D NURBS surface based on sample points on the surface, not control points – e.g. using the `createMesh()` approach?

Do you mind sharing something about what your data looks like and where is it coming from? Maybe share a small point collection, or whatever?

---

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [January 30, 2019, 9:58pm UTC](https://discourse.processing.org/t/nurbs-surface-with-toxiclibs/7747/3 "2019-01-30T21:58:38Z")

</div>

Dear @jeremydouglass,

Thank you for the reply. Ideally I would like to create a 3D NURBS surface and distort/warp it freely in real time with draggable _control points_ (no predetermined/fixed positions), quite like in the example below.

 ![07](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3697f9a31927c57fad25036c24013decb7b53750.png)

I don’t even know if that’s possible with toxiclibs.
