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