#include "tessclas.h"
#include "general.h"
Go to the source code of this file.
#define is_inside_angle | ( | pt | ) | (angle_change ((pt)->prev, (pt), (pt)->next) < inside_angle) |
Return true if the edgept supplied as input is an inside angle.
This is determined by the angular change of the vectors from point to point.
Definition at line 38 of file olutil.h.
Referenced by prioritize_points().
#define point_in_outline | ( | p, | |||
o | ) |
Value:
((p)->pos.x >= (o)->topleft.x && \ (p)->pos.y <= (o)->topleft.y && \ (p)->pos.x <= (o)->botright.x && \ (p)->pos.y >= (o)->botright.y) \
Note that this does not totally ensure that the edge point falls on this outline.
Definition at line 49 of file olutil.h.
Referenced by find_split_in_blob().
#define same_outline_bounds | ( | outline, | |||
other_outline | ) |
Value:
(outline->topleft.x == other_outline->topleft.x && \ outline->topleft.y == other_outline->topleft.y && \ outline->botright.x == other_outline->botright.x && \ outline->botright.y == other_outline->botright.y) \
Definition at line 60 of file olutil.h.
Referenced by eliminate_duplicate_outlines().
#define weighted_edgept_dist | ( | p1, | |||
p2, | |||||
x_y_weight | ) |
Value:
(((p1)->pos.x - (p2)->pos.x) * \ ((p1)->pos.x - (p2)->pos.x) * x_y_weight + \ ((p1)->pos.y - (p2)->pos.y) * \ ((p1)->pos.y - (p2)->pos.y))
Definition at line 71 of file olutil.h.
Referenced by grade_split_length(), try_point_pairs(), and try_vertical_splits().
void check_outline_mem | ( | ) |
Check the memory allocator for outlines.
Definition at line 39 of file olutil.cpp.
References newoutline(), olinestruct::next, and oldoutline.
Referenced by apply_seam(), and undo_seam().
00039 { 00040 TESSLINE *outline; 00041 00042 outline = newoutline (); 00043 outline->next = newoutline (); 00044 oldoutline (outline->next); 00045 oldoutline(outline); 00046 00047 outline = newoutline (); 00048 outline->next = newoutline (); 00049 oldoutline (outline->next); 00050 oldoutline(outline); 00051 }
Check to see if the blobs are in the correct order.
If they are not then swap which outlines are attached to which blobs.
Definition at line 60 of file olutil.cpp.
References blob_origin(), blobstruct::outlines, and TPOINT::x.
Referenced by form_two_blobs().
00060 { 00061 TPOINT origin1; 00062 TPOINT origin2; 00063 TESSLINE *temp; 00064 00065 blob_origin(blob1, &origin1); 00066 blob_origin(blob2, &origin2); 00067 00068 if (origin1.x > origin2.x) { 00069 temp = blob2->outlines; 00070 blob2->outlines = blob1->outlines; 00071 blob1->outlines = temp; 00072 } 00073 }
void eliminate_duplicate_outlines | ( | TBLOB * | blob | ) |
Find and delete any duplicate outline records in this blob.
Definition at line 80 of file olutil.cpp.
References olinestruct::next, oldoutline, blobstruct::outlines, and same_outline_bounds.
Referenced by form_two_blobs(), and undo_seam().
00080 { 00081 TESSLINE *outline; 00082 TESSLINE *other_outline; 00083 TESSLINE *last_outline; 00084 00085 for (outline = blob->outlines; outline; outline = outline->next) { 00086 00087 for (last_outline = outline, other_outline = outline->next; 00088 other_outline; 00089 last_outline = other_outline, other_outline = other_outline->next) { 00090 00091 if (same_outline_bounds (outline, other_outline)) { 00092 last_outline->next = other_outline->next; 00093 oldoutline(other_outline); 00094 other_outline = last_outline; 00095 } 00096 } 00097 } 00098 }
void setup_blob_outlines | ( | TBLOB * | blob | ) |
Set up each of the outlines in this blob.
Definition at line 138 of file olutil.cpp.
References olinestruct::next, blobstruct::outlines, and setup_outline().
Referenced by form_two_blobs(), and undo_seam().
00138 { 00139 TESSLINE *outline; 00140 00141 for (outline = blob->outlines; outline; outline = outline->next) { 00142 setup_outline(outline); 00143 } 00144 }
void setup_outline | ( | TESSLINE * | outline | ) |
Create a new outline structure from this
Definition at line 105 of file olutil.cpp.
References olinestruct::botright, olinestruct::loop, MAXINT, edgeptstruct::next, edgeptstruct::pos, olinestruct::topleft, TPOINT::x, and TPOINT::y.
Referenced by make_single_split(), and setup_blob_outlines().
00105 { 00106 register EDGEPT *this_edge; 00107 register int minx = MAXINT; 00108 register int miny = MAXINT; 00109 register int maxx = -MAXINT; 00110 register int maxy = -MAXINT; 00111 00112 /* Find boundaries */ 00113 this_edge = outline->loop; 00114 do { 00115 if (this_edge->pos.x < minx) 00116 minx = this_edge->pos.x; 00117 if (this_edge->pos.y < miny) 00118 miny = this_edge->pos.y; 00119 if (this_edge->pos.x > maxx) 00120 maxx = this_edge->pos.x; 00121 if (this_edge->pos.y > maxy) 00122 maxy = this_edge->pos.y; 00123 this_edge = this_edge->next; 00124 } 00125 while (this_edge != outline->loop); 00126 /* Reset bounds */ 00127 outline->topleft.x = minx; 00128 outline->topleft.y = maxy; 00129 outline->botright.x = maxx; 00130 outline->botright.y = miny; 00131 }