• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  **	Filename:    xform2d.h
3  **	Purpose:     Definitions for using 2D point transformation library
4  **	Author:      Dan Johnson
5  **	History:     Fri Sep 22 09:57:08 1989, DSJ, Created.
6  **
7  **	(c) Copyright Hewlett-Packard Company, 1988.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  ******************************************************************************/
18 #ifndef   XFORM2D_H
19 #define   XFORM2D_H
20 
21 /**----------------------------------------------------------------------------
22           Include Files and Type Defines
23 ----------------------------------------------------------------------------**/
24 #include "fpoint.h"
25 
26 typedef struct
27 {
28   FLOAT32 a, b, c, d, tx, ty;
29 }
30 
31 
32 MATRIX_2D, *MATRIX_2D_PTR;
33 
34 /**----------------------------------------------------------------------------
35           Public Function Prototypes
36 ----------------------------------------------------------------------------**/
37 
38 void InitMatrix(MATRIX_2D *M);
39 void CopyMatrix(MATRIX_2D *A, MATRIX_2D *B);
40 
41 /* matrix scaling, translation, rotation, mirroring, etc.*/
42 void TranslateMatrix(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y);
43 void ScaleMatrix(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y);
44 
45 void MirrorMatrixInX(MATRIX_2D *M);
46 void MirrorMatrixInY(MATRIX_2D *M);
47 void MirrorMatrixInXY(MATRIX_2D *M);
48 
49 /* using a matrix to map points*/
50 FLOAT32 MapX(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y);
51 
52 FLOAT32 MapY(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y);
53 
54 void MapPoint(MATRIX_2D *M, const FPOINT &A, FPOINT* B);
55 
56 FLOAT32 MapDx(MATRIX_2D *M, FLOAT32 DX, FLOAT32 DY);
57 FLOAT32 MapDy(MATRIX_2D M, FLOAT32 DX, FLOAT32 DY);
58 
59 void RotateMatrix(MATRIX_2D_PTR Matrix, FLOAT32 Angle);
60 #endif
61