I would like to get a world position of a specific parameter along a nurbs curve defined by a list of positions. Currently I'm creating a temporary curve in the plugin just to get an array of positions along this curve:
# targetXforms = array of MPoints
# knots = knots list
# uValue = array of floats (0->1)
#
curveFn = om.MFnNurbsCurve()
curveFn.create(targetXforms, knots, 3, om.MFnNurbsCurve.kOpen, False, False, nullObj)
for i in range (numRefXforms):
point = curveFn.getPointAtParam (uValue[i])
print point
Is there a better way to do this (i.e. not have the overhead of creating a curve)? Some math libraries perhaps? If not how do I delete this curve so I don't have a curve created every time the plugin is evaluated (MDGModifier seems to be a bit crashy)
Also, is there a way to find length along a curve for a given parameter value. Maya 2016 Extension 2 has a function for this: MFnNurbsCurve::findLengthFromParam()
But, We don't have this extension yet. :(
Thanks in advance!