Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
olutil.h
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: olutil.h (Formerly olutil.h)
5  * Description:
6  * Author: Mark Seaman, SW Productivity
7  * Created: Fri Oct 16 14:37:00 1987
8  * Modified: Wed Jul 10 14:21:55 1991 (Mark Seaman) marks@hpgrlt
9  * Language: C
10  * Package: N/A
11  * Status: Reusable Software Component
12  *
13  * (c) Copyright 1987, 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 OLUTIL_H
26 #define OLUTIL_H
27 
28 /*----------------------------------------------------------------------
29  I n c l u d e s
30 ----------------------------------------------------------------------*/
31 #include "blobs.h"
32 
33 /*----------------------------------------------------------------------
34  M a c r o s
35 ----------------------------------------------------------------------*/
36 /**********************************************************************
37  * is_inside_angle
38  *
39  * Return true if the edgept supplied as input is an inside angle. This
40  * is determined by the angular change of the vectors from point to
41  * point.
42 
43  **********************************************************************/
44 
45 #define is_inside_angle(pt) \
46 (angle_change ((pt)->prev, (pt), (pt)->next) < chop_inside_angle)
47 
48 /**********************************************************************
49  * same_outline_bounds
50  *
51  * Return TRUE if these two outlines have the same bounds.
52  **********************************************************************/
53 
54 #define same_outline_bounds(outline,other_outline) \
55 (outline->topleft.x == other_outline->topleft.x && \
56  outline->topleft.y == other_outline->topleft.y && \
57  outline->botright.x == other_outline->botright.x && \
58  outline->botright.y == other_outline->botright.y) \
59 
60 
61 /**********************************************************************
62  * weighted_edgept_dist
63  *
64  * Return the distance (squared) between the two edge points.
65  **********************************************************************/
66 
67 #define weighted_edgept_dist(p1,p2,chop_x_y_weight) \
68 (((p1)->pos.x - (p2)->pos.x) * \
69  ((p1)->pos.x - (p2)->pos.x) * chop_x_y_weight + \
70  ((p1)->pos.y - (p2)->pos.y) * \
71  ((p1)->pos.y - (p2)->pos.y))
72 
73 /*----------------------------------------------------------------------
74  F u n c t i o n s
75 ----------------------------------------------------------------------*/
76 void correct_blob_order(TBLOB *blob1, TBLOB *blob2);
77 
79 
80 void setup_blob_outlines(TBLOB *blob);
81 
82 #endif