[Numpy-discussion] Iterative Matrix Multiplication
Charles R Harris
Sun Feb 28 21:08:55 CST 2010
On Sun, Feb 28, 2010 at 7:58 PM, Ian Mallett <email@example.com> wrote:
> On Sun, Feb 28, 2010 at 6:54 PM, Charles R Harris <
> firstname.lastname@example.org> wrote:
>> Why not just add a vector to get translation? There is no need to go the
>> homogeneous form. Or you can just leave the vectors at length 4 and use a
>> slice to access the first three components. That way you can leave the ones
>> in place.
> Oh . . . duh :D
> Excellent--and a 3D rotation matrix is 3x3--so the list can remain n*3.
> Now the question is how to apply a rotation matrix to the array of vec3?
It looks like you want something like
res = dot(vec, rot) + tran
You can avoid an extra copy being made by separating the parts
res = dot(vec, rot)
res += tran
where I've used arrays, not matrices. Note that the rotation matrix
multiplies every vector in the array.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion