Main Page Class Hierarchy Compound List File List Compound Members

# wxTransformMatrix Class Reference

A simple 3x3 matrix. This may be replaced by a more general matrix. More...

`#include <wxmatrix.h>`

List of all members.

## Public Methods
double | GetValue (int col, int row) const
void | SetValue (int col, int row, double value)
wxTransformMatrix & | operator *= (const double &t)
| multiply every element by t
wxTransformMatrix & | operator/= (const double &t)
| divide every element by t
wxTransformMatrix & | operator+= (const wxTransformMatrix &m)
| add matrix m to this t
wxTransformMatrix & | operator-= (const wxTransformMatrix &m)
| subtract matrix m from this
wxTransformMatrix & | operator *= (const wxTransformMatrix &m)
| multiply matrix m with this
wxTransformMatrix | operator * (const double &t) const
| constant operatorsmultiply every element by t and return result
wxTransformMatrix | operator/ (const double &t) const
| divide this matrix by t and return result
wxTransformMatrix | operator+ (const wxTransformMatrix &m) const
| add matrix m to this and return result
wxTransformMatrix | operator- (const wxTransformMatrix &m) const
| subtract matrix m from this and return result
wxTransformMatrix | operator * (const wxTransformMatrix &m) const
| multiply this by matrix m and return result
double & | operator() (int col, int row)
double | operator() (int col, int row) const
bool | Invert (void)
| Invert matrix.
bool | Identity (void)
| Make into identity matrix.
bool | IsIdentity (void) const
bool | IsIdentity1 (void) const
| This does an actual check.
bool | Scale (double scale)
| Scale by scale (isotropic scaling i.e. the same in x and y):.
wxTransformMatrix & | Scale (const double &xs, const double &ys, const double &xc, const double &yc)
wxTransformMatrix & | Mirror (bool x=true, bool y=false)
| mirror a matrix in x, y
bool | Translate (double x, double y)
| Translate by dx, dy:.
bool | Rotate (double angle)
| Rotate clockwise by the given number of degrees:.
wxTransformMatrix & | Rotate (const double &r, const double &x, const double &y)
double | TransformX (double x) const
| Transform X value from logical to device.
double | TransformY (double y) const
| Transform Y value from logical to device.
bool | TransformPoint (double x, double y, double &tx, double &ty) const
| Transform a point from logical to device coordinates.
bool | InverseTransformPoint (double x, double y, double &tx, double &ty) const
| Transform a point from device to logical coordinates.

## Detailed Description

A simple 3x3 matrix. This may be replaced by a more general matrix.

class some day.

A 3x3 matrix to do 2D transformations. It can be used to map data to window coordinates. But also for manipulating your own data. For example drawing a picture (composed of several primitives) at a certain coordinate and angle within another parent picture. At all times m_isIdentity is set if the matrix itself is an Identity matrix. It is used where possible to optimize calculations.

## Member Function Documentation

double wxTransformMatrix::GetValue | ( | int | col,
|  | int | row
| ) | const

| get the value in the matrix at col,row rows are horizontal (second index of m_matrix member) columns are vertical (first index of m_matrix member)

bool wxTransformMatrix::InverseTransformPoint | ( | double | x,
|  | double | y,
|  | double & | tx,
|  | double & | ty
| ) | const

| Transform a point from device to logical coordinates. Example of use:
               wxTransformMatrix mat = dc.GetTransformation();
               mat.Invert();
               mat.InverseTransformPoint(x, y, x1, y1);
OR (shorthand:)
               dc.LogicalToDevice(x, y, x1, y1);
The latter is slightly less efficient if we're doing several conversions, since the matrix is inverted several times. N.B. 'this' matrix is the inverse at this point

bool wxTransformMatrix::IsIdentity | ( | void |  | ) | const`[inline]`

| Is the matrix the identity matrix? Only returns a flag, which is set whenever an operation is done.

bool wxTransformMatrix::IsIdentity1 | ( | void |  | ) | const`[inline]`

| This does an actual check. Is the matrix the identity matrix? Each operation checks whether the result is still the identity matrix and sets a flag.

wxTransformMatrix& wxTransformMatrix::Mirror | ( | bool | x = true,
|  | bool | y = false
| ) |

  | mirror a matrix in x, y Example: mirror
                     | -1     0      0 |
           matrix' = |  0    -1      0 | x matrix
                     |  0     0      1 |

double wxTransformMatrix::operator() | ( | int | col,
|  | int | row
| ) | const

| rows are horizontal (second index of m_matrix member) columns are vertical (first index of m_matrix member)

double& wxTransformMatrix::operator() | ( | int | col,
|  | int | row
| ) |

| rows are horizontal (second index of m_matrix member) columns are vertical (first index of m_matrix member)

wxTransformMatrix& wxTransformMatrix::Rotate | ( | const double & | r,
|  | const double & | x,
|  | const double & | y
| ) |

  | Example: rotate
                     |  cos(r) -sin(r)    x(1-cos(r))+y(sin(r)|
           matrix' = |  sin(r)  cos(r)    y(1-cos(r))-x(sin(r)| x matrix
                     |   0          0                       1 |

bool wxTransformMatrix::Rotate | ( | double | angle | ) |

  | Rotate clockwise by the given number of degrees:. Example: rotate
                     |  cos sin 0 |
           matrix' = | -sin cos 0 | x matrix
                     |   0   0  1 |

wxTransformMatrix& wxTransformMatrix::Scale | ( | const double & | xs,
|  | const double & | ys,
|  | const double & | xc,
|  | const double & | yc
| ) |

  | Example: scale
                     |  xs    0      xc(1-xs) |
           matrix' = |  0    ys      yc(1-ys) | x matrix
                     |  0     0      1        |

bool wxTransformMatrix::Scale | ( | double | scale | ) |

  | Scale by scale (isotropic scaling i.e. the same in x and y):. Example: scaling
                     | scale  0      0      |
           matrix' = |  0     scale  0      | x matrix
                     |  0     0      scale  |

void wxTransformMatrix::SetValue | ( | int | col,
|  | int | row,
|  | double | value
| ) |

| set the value in the matrix at col,row rows are horizontal (second index of m_matrix member) columns are vertical (first index of m_matrix member)

double wxTransformMatrix::TransformX | ( | double | x | ) | const`[inline]`

| Transform X value from logical to device. Transform X value from logical to device warning: this function can only be used for this purpose because no rotation is involved when mapping logical to device coordinates mirror and scaling for x and y will be part of the matrix if you have a matrix that is rotated, eg a shape containing a matrix to place it in the logical coordinate system, use TransformPoint

double wxTransformMatrix::TransformY | ( | double | y | ) | const`[inline]`

| Transform Y value from logical to device. Transform Y value from logical to device warning: this function can only be used for this purpose because no rotation is involved when mapping logical to device coordinates mirror and scaling for x and y will be part of the matrix if you have a matrix that is rotated, eg a shape containing a matrix to place it in the logical coordinate system, use TransformPoint

bool wxTransformMatrix::Translate | ( | double | x,
|  | double | y
| ) |

  | Translate by dx, dy:. Example: Translate
                     | 1  0 dx |
           matrix' = | 0  1 dy | x matrix
                     | 0  0  1 |

The documentation for this class was generated from the following file:

- wxmatrix.h

wxTransformMatrix class Reference -- Thu Nov 28 21:24:57 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . -- Main Page