ApplyMatrix Command

From GeoGebra Manual
Revision as of 16:17, 7 October 2017 by Zbynek (talk | contribs) (Text replace - ";(.*)\[(.*)\]" to ";$1($2)")
Jump to: navigation, search


ApplyMatrix( <([Matrices|Matrix)]>, <Object> )
Transforms the object O so that point P of O is mapped to:
  • point M*P, if P is a 2D point and M is a 2 x 2 matrix
Example: Let M={{cos(π/2),-sin(π/2)}, {sin(π/2), cos(π/2)}} be the transformation matrix and u = (2,1) a given vector (object). ApplyMatrix(M,u) yields the vector u'=(-1,2), i.e. the result of a mathematically positive rotation by 90° of vector u.
  • point project(M*(x(P), y(P), 1)), if P is a 2D point and M a 3 x 3 matrix: project is a projection, mapping point (x, y, z) to (x/z, y/z).
Example: Let M={{1,1,0},{0,1,1},{1,0,1}} be a matrix and u=(2,1) a given vector. ApplyMatrix(M,u) yields vector u'=(1,0.67). In effect \begin{pmatrix}1&1&0\\ 0&1&1\\1&0&1 \end{pmatrix} \begin{pmatrix}2\\ 1\\1 \end{pmatrix} = \begin{pmatrix}3\\ 2\\3 \end{pmatrix}, and (3/3 = 1, 2/3 ≈ 0.67) (rounding to 2 decimal places)
  • point M*P, if P is a 3D point and M a 3 x 3 matrix
  • point N*P, if P is a 3D point and M a 2 x 2 matrix: the matrix N is the completion or order 3 of M: given M = \begin{pmatrix}a&b\\ c&d \end{pmatrix} then N = \begin{pmatrix}a&b&0\\ c&d&0\\0&0&1 \end{pmatrix}
Note: This command also works for images.
© 2024 International GeoGebra Institute