Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vecfuncs.cpp
Go to the documentation of this file.
1 /* -*-C-*-
2 ********************************************************************************
3 *
4 * File: vecfuncs.c (Formerly vecfuncs.c)
5 * Description: Blob definition
6 * Author: Mark Seaman, OCR Technology
7 * Created: Fri Oct 27 15:39:52 1989
8 * Modified: Tue Jul 9 17:44:12 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 * Revision 5.1 89/07/27 11:47:50 11:47:50 ray ()
26 * Added ratings acces methods.
27 * This version ready for independent development.
28 */
29 /*----------------------------------------------------------------------
30 I n c l u d e s
31 ----------------------------------------------------------------------*/
32 #include "mfcpch.h"
33 #include "vecfuncs.h"
34
35 /*----------------------------------------------------------------------
36 F u n c t i o n s
37 ----------------------------------------------------------------------*/
38 /**********************************************************************
39 * direction
40 *
41 * Show if the line is going in the positive or negative X direction.
42 **********************************************************************/
43 int direction(EDGEPT *point) {
44 int dir;
45 EDGEPT *prev;
46 EDGEPT *next;
48 dir = 0;
49 prev = point->prev;
50 next = point->next;
51
52 if (((prev->pos.x <= point->pos.x) &&
53 (point->pos.x < next->pos.x)) ||
54 ((prev->pos.x < point->pos.x) && (point->pos.x <= next->pos.x)))
55 dir = 1;
56
57 if (((prev->pos.x >= point->pos.x) &&
58 (point->pos.x > next->pos.x)) ||
59 ((prev->pos.x > point->pos.x) && (point->pos.x >= next->pos.x)))
60 dir = -1;
61
62 return dir;
63 }