Hey guys. long time lurker, first post...
I posted this over on stack overflow, but I think this might be a better place for it..
I am creating a toolset for creating nurbs curves/surfaces inside maya using python.
I have a set of dictionaries that include cvPositions, knots, form etc. each of which describe a preset 3d shape (cube, circle, pyramid etc). I also have a 3d matrix stored in the nodes metadata that is used as an offset for the shape. This allows you to scale/move/rotate the shape without moving the transform.
The problem is in the way I am applying this matrix is very slow:
First I will create a new (edit)transform at the position of the (orig)transform containing the curves. Next I will transfer cv positions in world space from (orig)transform to (edit)transform. Next i will move the (edit)transform into the matrix position. Finally I will world space transfer the cvPositions back to the (orig)transform
When creating hundreds of shapes, this is becoming prohibitively slow...
Can someone describe a mathematical way to apply a matrix to a set of 3d points? maybe using one of pythons math modules or perhaps numpy?
Alternatively,
Is there a way using OpenMaya api functions to do this? Perhaps with MPointArray? The following code block is about as far as I have gotten on that front:
cheers,
-Paxton
crv = OpenMaya.MFnNurbsCurve( self.dagPath )
cvs = OpenMaya.MPointArray()
space = OpenMaya.MSpace.kWorld
crv.getCVs(cvs, space)
positions = []
for i in range(cvs.length()):
pt = cvs[i]
positions.append( (pt[0], pt[1], pt[2]) )
--
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/20487b33-cb96-4bd6-8b99-de2d6e02c73e%40googlegroups.com.
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/84c1cdee-be7b-469e-8778-7da3ee40436b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sure, the opposite of a decomposeMatrix is called composeMatrix. Alternatively, you could use any transform node, as it will have regular t, r and s channels, and its outcoming matrix, either world or local.
Once you've got your t, r and s values baked into a matrix, there is a node called wtAddMatrix which "adds" a matrix onto another matrix, with the possibility to also blend, or "weight" either matrix.
On Monday, May 5, 2014, Paxton <paxton...@gmail.com> wrote:
Interesting idea!--I am setting this up to test the speed difference.One question though. Since the transformGeometry nodes "transform" attr is a matrix attribute, how would I input a translate rotate or scale value?is there a simple way to add translate/rotate/scale values to a matrix?
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+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/84c1cdee-be7b-469e-8778-7da3ee40436b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/55154320-c64a-4050-9ebd-5928faae0e59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.