[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Passing pionts through a matrix.
campbell barton wrote:
Hi, I am thinking about making a program where you can pass a list of points (x,y) through a rotation/scale/distortion matrix.In numeric is another module called Matrix.
This could be done through python but I was wondering if numeric would be better?
It would be a polyline - Not a image.
They are pretty much the same as opengl matrices. Below is how to make
a translation matrix. Just make your points z be 0.
""" returns a translation matrix from the position given(x,y,z).
x,y,z = position
return Matrix.Matrix( [[ 1., 0., 0., 0.,],
[ 0., 1., 0., 0.,],
[ 0., 0., 1., 0.,],
[ x, y, z, 1.,] ] )