Numeric question, putting one matrix into another

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Mar 29 05:40:30 EST 2001


Jorn Verwey <jorn.verwey at psi.ch> writes:
> Using Numeric-arrays I have made a (3x3) rotation-matrix. Now I would like to put this rotation
> matrix in a (4x4) transformation matrix.

That's easy:

   rotation = Numeric.zeros((3,3), Numeric.Float)
   transformation = Numeric.zeros((4,4), Numeric.Float)

   transformation[:3, :3] = rotation

BTW, you might be interested in the module
Scientific.Geometry.Transformation, which is part of Scientific Python
(http://starship.python.net/crew/hinsen/scientific.html). It handles
linear transformations with some added luxury.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Python-list mailing list