Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vecfuncs.h
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: vecfuncs.h (Formerly vecfuncs.h)
5  * Description: Vector calculations
6  * Author: Mark Seaman, OCR Technology
7  * Created: Wed Dec 20 09:37:18 1989
8  * Modified: Tue Jul 9 17:44:37 1991 (Mark Seaman) marks@hpgrlt
9  * Language: C
10  * Package: N/A
11  * Status: Experimental (Do Not Distribute)
12  *
13  * (c) Copyright 1989, Hewlett-Packard Company.
14  ** Licensed under the Apache License, Version 2.0 (the "License");
15  ** you may not use this file except in compliance with the License.
16  ** You may obtain a copy of the License at
17  ** http://www.apache.org/licenses/LICENSE-2.0
18  ** Unless required by applicable law or agreed to in writing, software
19  ** distributed under the License is distributed on an "AS IS" BASIS,
20  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  ** See the License for the specific language governing permissions and
22  ** limitations under the License.
23  *
24  *********************************************************************************/
25 #ifndef VECFUNCS_H
26 #define VECFUNCS_H
27 
28 #include <math.h>
29 #include "blobs.h"
30 
31 class EDGEPT;
32 
33 /*----------------------------------------------------------------------
34  M a c r o s
35 ----------------------------------------------------------------------*/
36 /**********************************************************************
37  * point_diff
38  *
39  * Return the difference from point (p1) to point (p2). Put the value
40  * into point (p).
41  **********************************************************************/
42 
43 #define point_diff(p,p1,p2) \
44 ((p).x = (p1).x - (p2).x, \
45  (p).y = (p1).y - (p2).y, \
46  (p))
47 
48 /**********************************************************************
49  * CROSS
50  *
51  * cross product
52  **********************************************************************/
53 
54 #define CROSS(a,b) \
55 ((a).x * (b).y - (a).y * (b).x)
56 
57 /**********************************************************************
58  * SCALAR
59  *
60  * scalar vector product
61  **********************************************************************/
62 
63 #define SCALAR(a,b) \
64 ((a).x * (b).x + (a).y * (b).y)
65 
66 /**********************************************************************
67  * LENGTH
68  *
69  * length of vector
70  **********************************************************************/
71 
72 #define LENGTH(a) \
73 ((a).x * (a).x + (a).y * (a).y)
74 
75 /*----------------------------------------------------------------------
76  F u n c t i o n s
77 ----------------------------------------------------------------------*/
78 int direction(EDGEPT *point);
79 
80 #endif