Discussion:
[Maya-Python] [NurbsCurve] Alogrithm create curve from joints
Rémi Deletrain
2018-11-28 09:49:05 UTC
Permalink
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.
--
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_maya+***@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.
Marcus Ottosson
2018-11-28 10:09:48 UTC
Permalink
This should help:
https://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/CommandsPython/curve.html

You'd just need to get the worldspace position of each joint, and pass it
in.
Post by Rémi Deletrain
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.
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/298c5b02-6773-464f-bfc6-917fccb651cd%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/298c5b02-6773-464f-bfc6-917fccb651cd%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBF8YKkq6G47P7WiHJNqJxXWTFJh5jhb3ZNco40XKocvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Rémi Deletrain
2018-11-28 11:12:57 UTC
Permalink
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
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/28c05c92-d5d1-429a-80de-32ca5b22e7eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Marcus Ottosson
2018-11-28 14:11:29 UTC
Permalink
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 <https://en.wikipedia.org/wiki/Linear_interpolation> should
get you started, followed by a spline interpolation
<https://en.wikipedia.org/wiki/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.
Post by Rémi Deletrain
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
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/28c05c92-d5d1-429a-80de-32ca5b22e7eb%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/28c05c92-d5d1-429a-80de-32ca5b22e7eb%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODKwSYOvtnXAh90KaQ1u%2BvBghFXnxxc%2BVBGM8R0o%2B115w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Rémi Deletrain
2018-11-28 14:31:16 UTC
Permalink
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
<http://www.math.ucla.edu/~baker/149.1.02w/handouts/dd_splines.pdf>. I
think is a good way but It's very difficult to me to understand all. I'm
trying to translate it right now.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/771968ab-33e4-4dfe-8c5e-8a8624b84bbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CharlieWales
2018-11-28 15:16:44 UTC
Permalink
I think you need to pass your positions to the curve command as edit points
rather than curve points.
Post by Rémi Deletrain
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
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/28c05c92-d5d1-429a-80de-32ca5b22e7eb%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/28c05c92-d5d1-429a-80de-32ca5b22e7eb%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFzJ14XS1YmTz8BnzUpjr7hVFr6cwhkSU4AjM_oOo1QDebzCZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Rémi Deletrain
2018-11-28 15:27:21 UTC
Permalink
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/f0af8d43-fdd8-401b-aa03-04220a3445a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Angelo Sta. Catalina
2018-11-29 03:00:02 UTC
Permalink
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.
Post by Rémi Deletrain
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f0af8d43-fdd8-401b-aa03-04220a3445a6%40googlegroups.com
<https://groups.google.com/d/msgid/python_inside_maya/f0af8d43-fdd8-401b-aa03-04220a3445a6%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAJAkR62GqNoJOK5gEfSoA9fn%2BqDVdGSs4fEfK_sq7gAd503bcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Rémi Deletrain
2018-11-29 12:52:52 UTC
Permalink
Thank you for the book angelo. I will see if my company wants to buy it.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d8f6e120-9bd6-444c-ae4c-b3da9fdfeaaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Michael Boon
2018-11-30 01:19:36 UTC
Permalink
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
Post by Rémi Deletrain
Thank you for the book angelo. I will see if my company wants to buy it.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d6362b32-fb08-4ac1-a0b3-4d033ea664a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
f***@gmail.com
2018-11-30 15:36:23 UTC
Permalink
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 ! ) ?
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
Thank you for the book angelo. I will see if my company wants to buy it.
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d4a48788-28a4-4501-9472-1fb837106a44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rémi Deletrain
2018-12-04 09:20:45 UTC
Permalink
Hi everyone,

Thanks for your reply !
I have not had time to look since my last post. I try to look this week
--
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_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/dfe5eda0-3fa2-47b8-80a2-a4f9e3412c0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...