tesseract  4.0.0-1-g2a2b
vecfuncs.cpp
Go to the documentation of this file.
1 /* -*-C-*-
2  ********************************************************************************
3  *
4  * File: vecfuncs.cpp (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 access methods.
27  * This version ready for independent development.
28  */
29 /*----------------------------------------------------------------------
30  I n c l u d e s
31 ----------------------------------------------------------------------*/
32 #include "vecfuncs.h"
33 #include "blobs.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 }
TPOINT pos
Definition: blobs.h:170
int direction(EDGEPT *point)
Definition: vecfuncs.cpp:43
Definition: blobs.h:83
EDGEPT * prev
Definition: blobs.h:177
int16_t x
Definition: blobs.h:78
EDGEPT * next
Definition: blobs.h:176