View Full Version : Transform object & matrices

03-24-2003, 11:20 AM
Hello everybody,

Is there any way to specify a transform object coefficient by coefficient? from what I have seen vizmat allows you to make only some special kinds of matrices. What if I want to reconstruct the perspective matrix that looks nothing like a rotation, translation or scaling?

(student at the MVL MIT)

03-24-2003, 11:49 AM
Hi David,

I'm not exactly sure what you want to do, but you can manually set each individual element of the 4x4 matrix. The transform object has a function called 'set' which takes 16 numbers.

import vizmat

tran = vizmat.Transform()
tran.set(1,2,3, ... , 16)

Is this what you were looking for?

-- Farshid

03-24-2003, 11:59 AM
thanks farshid

The method you mention is not in the vizard help (at least not the one I have), this is why I did not see it, but this is exactly what I was looking for.


03-24-2003, 12:09 PM
Hi David,

I noticed a small bug in the vizmat library that will give you errors when trying to use the 'set' function. It will be fixed by the next release, but for now, here's how you can fix it:

Go to the main Vizard directory on your computer and open up 'vizmat.py'

Line 119 will be:

transform.set(self,self.id,f1,f2,f3,f4,f5,f6,f7,f8 ,f9,f10,f11,f12,f13,f14,f15,f16)

You should change it to:

transform.set(self.id,f1,f2,f3,f4,f5,f6,f7,f8,f9,f 10,f11,f12,f13,f14,f15,f16)

Save the file and restart Vizard.

Sorry about that.

-- Farshid

03-27-2003, 09:18 AM
Thanks for the comment, this is going to spare me some real trouble