tesseract  4.1.0
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  *
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  * Revision 5.1 89/07/27 11:47:50 11:47:50 ray ()
21  * Added ratings access methods.
22  * This version ready for independent development.
23  */
24 /*----------------------------------------------------------------------
25  I n c l u d e s
26 ----------------------------------------------------------------------*/
27 #include "vecfuncs.h"
28 #include "blobs.h"
29 
30 /*----------------------------------------------------------------------
31  F u n c t i o n s
32 ----------------------------------------------------------------------*/
33 /**********************************************************************
34  * direction
35  *
36  * Show if the line is going in the positive or negative X direction.
37  **********************************************************************/
38 int direction(EDGEPT *point) {
39  int dir;
40  EDGEPT *prev;
41  EDGEPT *next;
43  dir = 0;
44  prev = point->prev;
45  next = point->next;
46 
47  if (((prev->pos.x <= point->pos.x) &&
48  (point->pos.x < next->pos.x)) ||
49  ((prev->pos.x < point->pos.x) && (point->pos.x <= next->pos.x)))
50  dir = 1;
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  return dir;
58 }
int16_t x
Definition: blobs.h:73
EDGEPT * next
Definition: blobs.h:171
TPOINT pos
Definition: blobs.h:165
Definition: blobs.h:78
int direction(EDGEPT *point)
Definition: vecfuncs.cpp:38
EDGEPT * prev
Definition: blobs.h:172