[NurbsCurve] Alogrithm create curve from joints

351 views
Skip to first unread message

Rémi Deletrain

unread,
Nov 28, 2018, 4:49:05 AM11/28/18
to Python Programming for Autodesk Maya
Hi everyone,

With IKSpine options it's possible to create curve from joints.
Anyone know what algorithm it used for this step ?
Maya offert the command for create it without IKSpine command ?

Thanks for your reply.

Marcus Ottosson

unread,
Nov 28, 2018, 5:10:05 AM11/28/18
to python_in...@googlegroups.com

You'd just need to get the worldspace position of each joint, and pass it in.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/298c5b02-6773-464f-bfc6-917fccb651cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rémi Deletrain

unread,
Nov 28, 2018, 6:12:57 AM11/28/18
to Python Programming for Autodesk Maya
this code is juste for create Curve from given points.
With ikHandle options it's possible to given number of spans. (Maya create curve with all point and rebuild curve after ?)
But I surch solution without create curve. Pure mathematical solution

Marcus Ottosson

unread,
Nov 28, 2018, 9:11:49 AM11/28/18
to python_in...@googlegroups.com
Hm, a pure mathematical solution. I expect the ikHandle would make a curve similar to this, and then resample it afterwards to fit the spans requirement. To calculate the resampling yourself, then a linear interpolation should get you started, followed by a spline interpolation. It'll assume you have at least 2 points for input, and want more points as output. Once you've got all of your points, you could pass that to your `cmds.curve` command. Not entirely sure that's what you're after.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Rémi Deletrain

unread,
Nov 28, 2018, 9:31:17 AM11/28/18
to Python Programming for Autodesk Maya
I already used this interpollations.
But for use is you must know spline point. In my case I want to calculate spline point from 3D points.

If you create curve inside maya in degree 3 and you give your points. Curve points doesn't have a same position of given positions.
I found this doc dd_splines. I think is a good way but It's very difficult to me to understand all. I'm trying to translate it right now.

CharlieWales

unread,
Nov 28, 2018, 10:17:02 AM11/28/18
to python_in...@googlegroups.com
I think you need to pass your positions to the curve command as edit points rather than curve points. 

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Rémi Deletrain

unread,
Nov 28, 2018, 10:27:22 AM11/28/18
to Python Programming for Autodesk Maya
I don't want to use curve command for don't create curve node.
I need to calculate a new curve for each frame and create new curve for get position and delete it is really heavy.

Angelo Sta. Catalina

unread,
Nov 28, 2018, 9:59:31 PM11/28/18
to python_in...@googlegroups.com
I've written quite a few bits of code to calculate a nurbs curve without using Maya's built in commands - In plugins, primarily because Maya's MFnNurbsCurve isn't multi thread safe. Its not a simple algorithm since you have to calculate for continuity. If speed really is an issue, I would look into reading a book called "The NURBS Book" by Les A. Piegl and Wayne Tiller that goes in depth on how to write your own Nurbs curve or surface. It C style snippets of code that is pretty easy to translate into python. 

On Wed, Nov 28, 2018 at 9:27 AM Rémi Deletrain <remi.de...@gmail.com> wrote:
I don't want to use curve command for don't create curve node.
I need to calculate a new curve for each frame and create new curve for get position and delete it is really heavy.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Rémi Deletrain

unread,
Nov 29, 2018, 7:52:52 AM11/29/18
to Python Programming for Autodesk Maya
Thank you for the book angelo. I will see if my company wants to buy it.

Michael Boon

unread,
Nov 29, 2018, 8:19:36 PM11/29/18
to Python Programming for Autodesk Maya
You might try Cardinal splines, which are kind of Hermite splines. They're not NURBS; they're more like the splines used by animation curves. I've implemented these in 3D just by considering each axis separately, defining each axis as a function of some made-up parameter, which is the distance along the curve.
This site is pretty good: http://cubic.org/docs/hermite.htm

If you specifically want NURBS, or something more like NURBS (eg Beziers), maybe this site will be useful: https://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/opengl_programming.html#3

fruit...@gmail.com

unread,
Nov 30, 2018, 10:36:26 AM11/30/18
to Python Programming for Autodesk Maya
Same approach as Michael, maybe you should go for a curve that does have the specificity of passing through every point (e.g. Catmull-Rom, kind of a simplified version of hermite, both light and super easy to implement - the wiki page has everything you need ). From there, you can try to approximate a nurbs curve out of it (doing it the other way around seems pretty straight forward : https://forum.libcinder.org/topic/creating-catmull-rom-spline-from-the-bspline-class).
Likewise, I'd advice you create your own nurbsCurve object with only what you need, and not necessarily use the maya tools. Again, the wiki page about NURBS has the exact formula (https://fr.wikipedia.org/wiki/NURBS =p ), you just need to translate it into python (basically a cox-deboor recursive algorithm, the internet is full of examples and tutorials about it)

Alternatively, if you work in cpp, you can find pretty much everything you need with open source libs for generating curves, converting curves, etc...

Finally, depending on your needs, maybe you don't even need to stick to a NURBS curve, and can go for much lighter curves ? (again, catmull-rom for instance ! ) ?

Rémi Deletrain

unread,
Dec 4, 2018, 4:20:46 AM12/4/18
to Python Programming for Autodesk Maya
Hi everyone,

Thanks for your reply !
I have not had time to look since my last post. I try to look this week
Reply all
Reply to author
Forward
0 new messages