next up previous contents index
Next: Misc. functions and values Up: Vectors and Matrices Previous: Matrix routines   Contents   Index

Multiplying vectors and matrices

There are two commands to multiply a matrix and a vector, vectrans and coordtrans. They assume the vector is in column form and premultiply the matrix to the vector. If the vector contains four numbers, the two commands are identical. If the vector has three elements, a fourth is added; a 0 for vectrans and a 1 for coordtrans. The difference is that vectors are not affected by translations during transformations, while coordinates are.

vmd > vectrans [transaxis z 90] {1 0 0}
-3.67321e-06 1.0 0.0
vmd > vectrans [transvecinv {-3 4 -12}] {-3 4 -12}
13.0 -1.8e-05 5.8e-05