Tesseract
3.02
|
00001 /****************************************************************************** 00002 ** Filename: xform2d.h 00003 ** Purpose: Definitions for using 2D point transformation library 00004 ** Author: Dan Johnson 00005 ** History: Fri Sep 22 09:57:08 1989, DSJ, Created. 00006 ** 00007 ** (c) Copyright Hewlett-Packard Company, 1988. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 ******************************************************************************/ 00018 #ifndef XFORM2D_H 00019 #define XFORM2D_H 00020 00024 #include "fpoint.h" 00025 00026 typedef struct 00027 { 00028 FLOAT32 a, b, c, d, tx, ty; 00029 } 00030 00031 00032 MATRIX_2D, *MATRIX_2D_PTR; 00033 00038 void InitMatrix(MATRIX_2D *M); 00039 void CopyMatrix(MATRIX_2D *A, MATRIX_2D *B); 00040 00041 /* matrix scaling, translation, rotation, mirroring, etc.*/ 00042 void TranslateMatrix(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y); 00043 void ScaleMatrix(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y); 00044 00045 void MirrorMatrixInX(MATRIX_2D *M); 00046 void MirrorMatrixInY(MATRIX_2D *M); 00047 void MirrorMatrixInXY(MATRIX_2D *M); 00048 00049 /* using a matrix to map points*/ 00050 FLOAT32 MapX(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y); 00051 00052 FLOAT32 MapY(MATRIX_2D *M, FLOAT32 X, FLOAT32 Y); 00053 00054 void MapPoint(MATRIX_2D *M, const FPOINT &A, FPOINT* B); 00055 00056 FLOAT32 MapDx(MATRIX_2D *M, FLOAT32 DX, FLOAT32 DY); 00057 FLOAT32 MapDy(MATRIX_2D M, FLOAT32 DX, FLOAT32 DY); 00058 00059 void RotateMatrix(MATRIX_2D_PTR Matrix, FLOAT32 Angle); 00060 #endif