tesseract  4.00.00dev
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 
30 struct EDGEPT;
31 
32 /*----------------------------------------------------------------------
33  M a c r o s
34 ----------------------------------------------------------------------*/
35 /**********************************************************************
36  * point_diff
37  *
38  * Return the difference from point (p1) to point (p2). Put the value
39  * into point (p).
40  **********************************************************************/
41 
42 #define point_diff(p,p1,p2) \
43 ((p).x = (p1).x - (p2).x, \
44  (p).y = (p1).y - (p2).y)
45 
46 /**********************************************************************
47  * CROSS
48  *
49  * cross product
50  **********************************************************************/
51 
52 #define CROSS(a,b) \
53 ((a).x * (b).y - (a).y * (b).x)
54 
55 /**********************************************************************
56  * SCALAR
57  *
58  * scalar vector product
59  **********************************************************************/
60 
61 #define SCALAR(a,b) \
62 ((a).x * (b).x + (a).y * (b).y)
63 
64 /**********************************************************************
65  * LENGTH
66  *
67  * length of vector
68  **********************************************************************/
69 
70 #define LENGTH(a) \
71 ((a).x * (a).x + (a).y * (a).y)
72 
73 /*----------------------------------------------------------------------
74  F u n c t i o n s
75 ----------------------------------------------------------------------*/
76 int direction(EDGEPT *point);
77 
78 #endif
int direction(EDGEPT *point)
Definition: vecfuncs.cpp:43
Definition: blobs.h:76