# classify/xform2d.h File Reference

`#include "fpoint.h"`

## Define Documentation

 #define CopyMatrix ( A, B )

Value:

```((B)->a = (A)->a, (B)->b = (A)->b,  \
(B)->c = (A)->c, (B)->d = (A)->d,   \
(B)->tx = (A)->tx, (B)->ty = (A)->ty)
```
copy values from one transform matrics to another

Definition at line 49 of file xform2d.h.

 #define InitMatrix ( M )

Value:

```((M)->a = 1, (M)->b = 0,      \
(M)->c = 0, (M)->d = 1,    \
(M)->tx = 0, (M)->ty = 0 )
```
initialize transform matrices

Definition at line 44 of file xform2d.h.

Referenced by ComputeBulges().

 #define MapDx ( M, DX, DY ) ((M)->a * (DX) + (M)->c * (DY))

Definition at line 75 of file xform2d.h.

 #define MapDy ( M, DX, DY ) ((M)->b * (DX) + (M)->d * (DY))

Definition at line 76 of file xform2d.h.

 #define MapPoint ( M, A, B )

Value:

```(Xof(B) = MapX (M, Xof(A), Yof(A)), \
Yof(B) = MapY (M, Xof(A), Yof(A)))
```

Definition at line 73 of file xform2d.h.

Referenced by ComputeBulges().

 #define MapX ( M, X, Y ) ((M)->a * (X) + (M)->c * (Y) + (M)->tx)

using a matrix to map points, X

Definition at line 69 of file xform2d.h.

 #define MapY ( M, X, Y ) ((M)->b * (X) + (M)->d * (Y) + (M)->ty)

using a matrix to map points, Y

Definition at line 71 of file xform2d.h.

 #define MirrorMatrixInX ( M ) (ScaleMatrix((M),-1,1))

matrix mirroring in X

Definition at line 62 of file xform2d.h.

 #define MirrorMatrixInXY ( M ) (ScaleMatrix((M),-1,-1))

matrix mirroring in XY

Definition at line 66 of file xform2d.h.

 #define MirrorMatrixInY ( M ) (ScaleMatrix((M),1,-1))

matrix mirroring in Y

Definition at line 64 of file xform2d.h.

 #define ScaleMatrix ( M, X, Y )

Value:

```((M)->a *= (X), (M)->b *= (X),      \
(M)->c *= (Y), (M)->d *= (Y))
```
matrix scaling

Definition at line 58 of file xform2d.h.

 #define TranslateMatrix ( M, X, Y )

Value:

```((M)->tx += (M)->a * (X) + (M)->c * (Y),  \
(M)->ty += (M)->b * (X) + (M)->d * (Y) )
```
matrix translation

Definition at line 54 of file xform2d.h.

Referenced by ComputeBulges().

## Typedef Documentation

 typedef struct MATRIX_2D * MATRIX_2D_PTR

## Function Documentation

 void RotateMatrix ( MATRIX_2D_PTR Matrix, FLOAT32 Angle )

Rotate the coordinate system (as specified by Matrix) about its origin by Angle radians.

Parameters:
 Matrix Transformation matrix to rotate Angle Angle to rotate matrix
Returns:
none (Matrix is modified)
In matrix notation the effect is as follows:
```		Matrix = R X Matrix

where R is the following matrix

cos Angle   sin Angle   0
-sin Angle  cos Angle   0
0           0           1
```
Note:
Exceptions: none
Date:
7/27/89, DSJ, Create.

Definition at line 51 of file xform2d.cpp.

Referenced by ComputeBulges().

```00051                                                        {
00052   FLOAT32 Cos, Sin;
00053   FLOAT32 NewA, NewB;
00054
00055   Cos = cos ((double) Angle);
00056   Sin = sin ((double) Angle);
00057
00058   NewA = Matrix->a * Cos + Matrix->c * Sin;
00059   NewB = Matrix->b * Cos + Matrix->d * Sin;
00060   Matrix->c = Matrix->a * -Sin + Matrix->c * Cos;
00061   Matrix->d = Matrix->b * -Sin + Matrix->d * Cos;
00062   Matrix->a = NewA;
00063   Matrix->b = NewB;
00064
00065 }                                /* RotateMatrix */
```

Generated on Wed Feb 28 19:49:21 2007 for Tesseract by  1.5.1