Thanks for the reply.  Unfortunately, setMatrix appears to be broken in my 
install of pymel (maya 2011).  (See  
http://tech-artists.org/forum/showthread.php?1620-pymel-setMatrix() )

But that's beside the point, as the only thing it would prove is that 
matrix inversion and matrix-matrix multiplication works.  I'm trying to 
apply a matrix to a vector (actually, about 60,000 of them), and I'm not 
getting the expected results.  Unless there's something obvious that I'm 
missing, which is entirely possible.

What I want to do is transform an arbitrary point into the object space of 
a an arbitrary object.  Shouldn't my code above achieve that?

On Wednesday, August 1, 2012 12:06:20 AM UTC-4, Geordie Martinez wrote:
>
> Try this:
> import pymel.core as pm 
>
> sphere = pm.PyNode("pSphere1")
>
> sphereM = sphere.worldMatrix.get()
>
> sphereInvM = sphereM.inverse()
>
> sphere.setMatrix(sphereInvM * sphereM)
>
>
> On Tue, Jul 31, 2012 at 5:31 PM, meeotch wrote:
>
>> Hopefully someone can tell me how I'm screwing this up...
>>
>> 1)  create a sphere, translate it away from the origin
>> 2)  m = PyNode("pSphere1").worldMatrix.get()
>> 3)  v = PyNode("pSphere1").translate.get()
>>
>> So far, so good - m looks like a reasonable matrix, v is the position of 
>> the sphere.  So now:
>>
>> 4) m.inverse() * v  (or maybe the other way around)
>>
>> Shouldn't that give (0,0,0) ?  I.e., transforming the position back to 
>> the origin.  Or is matrix*vector multiplication not implemented?
>>  
>> -- 
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings: 
>> http://groups.google.com/group/python_inside_maya/subscribe
>>
>
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to