2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) any later version.
7 * This software is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // #define RECOGNIZER_DEBUG // uncomment for debug output
18 #define MAX_POLYGON_SIDES 4
20 #define LINE_MAX_DET 0.015 // maximum score for line (ideal line = 0)
21 #define CIRCLE_MIN_DET 0.95 // minimum det. score for circle (ideal circle = 1)
22 #define CIRCLE_MAX_SCORE 0.10 // max circle score for circle (ideal circle = 0)
24 #define SLANT_TOLERANCE (5*M_PI/180) // ignore slanting by +/- 5 degrees
25 #define RECTANGLE_ANGLE_TOLERANCE (15*M_PI/180) // angle tolerance in rectangles
26 #define RECTANGLE_LINEAR_TOLERANCE 0.20 // vertex gap tolerance in rectangles
27 #define POLYGON_LINEAR_TOLERANCE 0.20 // vertex gap tolerance in closed polygons
29 #define ARROW_MAXSIZE 0.8 // max size of arrow tip relative to main segment
30 #define ARROW_ANGLE_MIN (5*M_PI/180) // arrow tip angles relative to main segment
31 #define ARROW_ANGLE_MAX (50*M_PI/180)
32 #define ARROW_ASYMMETRY_MAX_ANGLE (30*M_PI/180)
33 #define ARROW_ASYMMETRY_MAX_LINEAR 1.0 // size imbalance of two legs of tip
34 #define ARROW_TIP_LINEAR_TOLERANCE 0.30 // gap tolerance on tip segments
35 #define ARROW_SIDEWAYS_GAP_TOLERANCE 0.25 // gap tolerance in lateral direction
36 #define ARROW_MAIN_LINEAR_GAP_MIN -0.3 // gap tolerance on main segment
37 #define ARROW_MAIN_LINEAR_GAP_MAX +0.7 // gap tolerance on main segment
39 void recognize_patterns(void);
40 void reset_recognizer(void);