tesseract  4.1.0
polyaprx.cpp File Reference
#include "polyaprx.h"
#include <cstdint>
#include "blobs.h"
#include "coutln.h"
#include "errcode.h"
#include "mod128.h"
#include "params.h"
#include "points.h"
#include "rect.h"
#include "tprintf.h"
#include "vecfuncs.h"

Go to the source code of this file.

Macros

#define FASTEDGELENGTH   256
 
#define FIXED   4 /*OUTLINE point is fixed */
 
#define RUNLENGTH   1 /*length of run */
 
#define DIR   2 /*direction of run */
 
#define FLAGS   0
 
#define fixed_dist   20
 
#define approx_dist   15
 

Functions

TESSLINEApproximateOutline (bool allow_detailed_fx, C_OUTLINE *c_outline)
 
EDGEPTedgesteps_to_edgepts (C_OUTLINE *c_outline, EDGEPT edgepts[])
 
void fix2 (EDGEPT *start, int area)
 
EDGEPTpoly2 (EDGEPT *startpt, int area)
 
void cutline (EDGEPT *first, EDGEPT *last, int area)
 

Variables

const int par1 = 4500 / (approx_dist * approx_dist)
 
const int par2 = 6750 / (approx_dist * approx_dist)
 

Macro Definition Documentation

#define approx_dist   15

Definition at line 46 of file polyaprx.cpp.

#define DIR   2 /*direction of run */

Definition at line 41 of file polyaprx.cpp.

#define FASTEDGELENGTH   256

Definition at line 31 of file polyaprx.cpp.

#define FIXED   4 /*OUTLINE point is fixed */

Definition at line 37 of file polyaprx.cpp.

#define fixed_dist   20

Definition at line 45 of file polyaprx.cpp.

#define FLAGS   0

Definition at line 43 of file polyaprx.cpp.

#define RUNLENGTH   1 /*length of run */

Definition at line 39 of file polyaprx.cpp.

Function Documentation

TESSLINE* ApproximateOutline ( bool  allow_detailed_fx,
C_OUTLINE c_outline 
)

Definition at line 62 of file polyaprx.cpp.

62  {
63  TBOX loop_box; // bounding box
64  int32_t area; // loop area
65  EDGEPT stack_edgepts[FASTEDGELENGTH]; // converted path
66  EDGEPT* edgepts = stack_edgepts;
67 
68  // Use heap memory if the stack buffer is not big enough.
69  if (c_outline->pathlength() > FASTEDGELENGTH)
70  edgepts = new EDGEPT[c_outline->pathlength()];
71 
72  loop_box = c_outline->bounding_box();
73  area = loop_box.height();
74  if (!poly_wide_objects_better && loop_box.width() > area)
75  area = loop_box.width();
76  area *= area;
77  edgesteps_to_edgepts(c_outline, edgepts);
78  fix2(edgepts, area);
79  EDGEPT* edgept = poly2(edgepts, area); // 2nd approximation.
80  EDGEPT* startpt = edgept;
81  EDGEPT* result = nullptr;
82  EDGEPT* prev_result = nullptr;
83  do {
84  auto* new_pt = new EDGEPT;
85  new_pt->pos = edgept->pos;
86  new_pt->prev = prev_result;
87  if (prev_result == nullptr) {
88  result = new_pt;
89  } else {
90  prev_result->next = new_pt;
91  new_pt->prev = prev_result;
92  }
93  if (allow_detailed_fx) {
94  new_pt->src_outline = edgept->src_outline;
95  new_pt->start_step = edgept->start_step;
96  new_pt->step_count = edgept->step_count;
97  }
98  prev_result = new_pt;
99  edgept = edgept->next;
100  }
101  while (edgept != startpt);
102  prev_result->next = result;
103  result->prev = prev_result;
104  if (edgepts != stack_edgepts)
105  delete [] edgepts;
106  return TESSLINE::BuildFromOutlineList(result);
107 }
int step_count
Definition: blobs.h:176
EDGEPT * poly2(EDGEPT *startpt, int area)
Definition: polyaprx.cpp:401
Definition: rect.h:34
EDGEPT * next
Definition: blobs.h:171
const TBOX & bounding_box() const
Definition: coutln.h:113
TPOINT pos
Definition: blobs.h:165
static TESSLINE * BuildFromOutlineList(EDGEPT *outline)
Definition: blobs.cpp:98
int16_t height() const
Definition: rect.h:108
int start_step
Definition: blobs.h:175
Definition: blobs.h:78
int32_t pathlength() const
Definition: coutln.h:135
int16_t width() const
Definition: rect.h:115
C_OUTLINE * src_outline
Definition: blobs.h:173
#define FASTEDGELENGTH
Definition: polyaprx.cpp:31
void fix2(EDGEPT *start, int area)
Definition: polyaprx.cpp:216
EDGEPT * edgesteps_to_edgepts(C_OUTLINE *c_outline, EDGEPT edgepts[])
Definition: polyaprx.cpp:117
EDGEPT * prev
Definition: blobs.h:172
void cutline ( EDGEPT first,
EDGEPT last,
int  area 
)

Definition at line 499 of file polyaprx.cpp.

503  {
504  EDGEPT *edge; /*current edge */
505  TPOINT vecsum; /*vector sum */
506  int vlen; /*approx length of vecsum */
507  TPOINT vec; /*accumulated vector */
508  EDGEPT *maxpoint; /*worst point */
509  int maxperp; /*max deviation */
510  int perp; /*perp distance */
511  int ptcount; /*no of points */
512  int squaresum; /*sum of perps */
513 
514  edge = first; /*start of line */
515  if (edge->next == last)
516  return; /*simple line */
517 
518  /*vector sum */
519  vecsum.x = last->pos.x - edge->pos.x;
520  vecsum.y = last->pos.y - edge->pos.y;
521  if (vecsum.x == 0 && vecsum.y == 0) {
522  /*special case */
523  vecsum.x = -edge->prev->vec.x;
524  vecsum.y = -edge->prev->vec.y;
525  }
526  /*absolute value */
527  vlen = vecsum.x > 0 ? vecsum.x : -vecsum.x;
528  if (vecsum.y > vlen)
529  vlen = vecsum.y; /*maximum */
530  else if (-vecsum.y > vlen)
531  vlen = -vecsum.y; /*absolute value */
532 
533  vec.x = edge->vec.x; /*accumulated vector */
534  vec.y = edge->vec.y;
535  maxperp = 0; /*none yet */
536  squaresum = ptcount = 0;
537  edge = edge->next; /*move to actual point */
538  maxpoint = edge; /*in case there isn't one */
539  do {
540  perp = CROSS (vec, vecsum); /*get perp distance */
541  if (perp != 0) {
542  perp *= perp; /*squared deviation */
543  }
544  squaresum += perp; /*sum squares */
545  ptcount++; /*count points */
546  if (poly_debug)
547  tprintf ("Cutline:Final perp=%d\n", perp);
548  if (perp > maxperp) {
549  maxperp = perp;
550  maxpoint = edge; /*find greatest deviation */
551  }
552  vec.x += edge->vec.x; /*accumulate vectors */
553  vec.y += edge->vec.y;
554  edge = edge->next;
555  }
556  while (edge != last); /*test all line */
557 
558  perp = LENGTH (vecsum);
559  ASSERT_HOST (perp != 0);
560 
561  if (maxperp < 256 * INT16_MAX) {
562  maxperp <<= 8;
563  maxperp /= perp; /*true max perp */
564  }
565  else {
566  maxperp /= perp;
567  maxperp <<= 8; /*avoid overflow */
568  }
569  if (squaresum < 256 * INT16_MAX)
570  /*mean squared perp */
571  perp = (squaresum << 8) / (perp * ptcount);
572  else
573  /*avoid overflow */
574  perp = (squaresum / perp << 8) / ptcount;
575 
576  if (poly_debug)
577  tprintf ("Cutline:A=%d, max=%.2f(%.2f%%), msd=%.2f(%.2f%%)\n",
578  area, maxperp / 256.0, maxperp * 200.0 / area,
579  perp / 256.0, perp * 300.0 / area);
580  if (maxperp * par1 >= 10 * area || perp * par2 >= 10 * area || vlen >= 126) {
581  maxpoint->flags[FLAGS] |= FIXED;
582  /*partitions */
583  cutline(first, maxpoint, area);
584  cutline(maxpoint, last, area);
585  }
586 }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
int16_t x
Definition: blobs.h:73
void cutline(EDGEPT *first, EDGEPT *last, int area)
Definition: polyaprx.cpp:499
EDGEPT * next
Definition: blobs.h:171
#define LENGTH(a)
Definition: vecfuncs.h:65
TPOINT pos
Definition: blobs.h:165
int16_t y
Definition: blobs.h:74
Definition: blobs.h:52
const int par2
Definition: polyaprx.cpp:49
const int par1
Definition: polyaprx.cpp:48
Definition: blobs.h:78
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:36
#define ASSERT_HOST(x)
Definition: errcode.h:88
#define FIXED
Definition: polyaprx.cpp:37
#define CROSS(a, b)
Definition: vecfuncs.h:47
#define FLAGS
Definition: polyaprx.cpp:43
VECTOR vec
Definition: blobs.h:166
EDGEPT * prev
Definition: blobs.h:172
EDGEPT* edgesteps_to_edgepts ( C_OUTLINE c_outline,
EDGEPT  edgepts[] 
)

Definition at line 117 of file polyaprx.cpp.

120  {
121  int32_t length; //steps in path
122  ICOORD pos; //current coords
123  int32_t stepindex; //current step
124  int32_t stepinc; //increment
125  int32_t epindex; //current EDGEPT
126  int32_t count; //repeated steps
127  ICOORD vec; //for this 8 step
128  ICOORD prev_vec;
129  int8_t epdir; //of this step
130  DIR128 prevdir; //prvious dir
131  DIR128 dir; //of this step
132 
133  pos = c_outline->start_pos (); //start of loop
134  length = c_outline->pathlength ();
135  stepindex = 0;
136  epindex = 0;
137  prevdir = -1;
138  count = 0;
139  int prev_stepindex = 0;
140  do {
141  dir = c_outline->step_dir (stepindex);
142  vec = c_outline->step (stepindex);
143  if (stepindex < length - 1
144  && c_outline->step_dir (stepindex + 1) - dir == -32) {
145  dir += 128 - 16;
146  vec += c_outline->step (stepindex + 1);
147  stepinc = 2;
148  }
149  else
150  stepinc = 1;
151  if (count == 0) {
152  prevdir = dir;
153  prev_vec = vec;
154  }
155  if (prevdir.get_dir () != dir.get_dir ()) {
156  edgepts[epindex].pos.x = pos.x ();
157  edgepts[epindex].pos.y = pos.y ();
158  prev_vec *= count;
159  edgepts[epindex].vec.x = prev_vec.x ();
160  edgepts[epindex].vec.y = prev_vec.y ();
161  pos += prev_vec;
162  edgepts[epindex].flags[RUNLENGTH] = count;
163  edgepts[epindex].prev = &edgepts[epindex - 1];
164  edgepts[epindex].flags[FLAGS] = 0;
165  edgepts[epindex].next = &edgepts[epindex + 1];
166  prevdir += 64;
167  epdir = DIR128(0) - prevdir;
168  epdir >>= 4;
169  epdir &= 7;
170  edgepts[epindex].flags[DIR] = epdir;
171  edgepts[epindex].src_outline = c_outline;
172  edgepts[epindex].start_step = prev_stepindex;
173  edgepts[epindex].step_count = stepindex - prev_stepindex;
174  epindex++;
175  prevdir = dir;
176  prev_vec = vec;
177  count = 1;
178  prev_stepindex = stepindex;
179  }
180  else
181  count++;
182  stepindex += stepinc;
183  }
184  while (stepindex < length);
185  edgepts[epindex].pos.x = pos.x ();
186  edgepts[epindex].pos.y = pos.y ();
187  prev_vec *= count;
188  edgepts[epindex].vec.x = prev_vec.x ();
189  edgepts[epindex].vec.y = prev_vec.y ();
190  pos += prev_vec;
191  edgepts[epindex].flags[RUNLENGTH] = count;
192  edgepts[epindex].flags[FLAGS] = 0;
193  edgepts[epindex].src_outline = c_outline;
194  edgepts[epindex].start_step = prev_stepindex;
195  edgepts[epindex].step_count = stepindex - prev_stepindex;
196  edgepts[epindex].prev = &edgepts[epindex - 1];
197  edgepts[epindex].next = &edgepts[0];
198  prevdir += 64;
199  epdir = DIR128(0) - prevdir;
200  epdir >>= 4;
201  epdir &= 7;
202  edgepts[epindex].flags[DIR] = epdir;
203  edgepts[0].prev = &edgepts[epindex];
204  ASSERT_HOST (pos.x () == c_outline->start_pos ().x ()
205  && pos.y () == c_outline->start_pos ().y ());
206  return &edgepts[0];
207 }
int step_count
Definition: blobs.h:176
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
ICOORD step(int index) const
Definition: coutln.h:144
int16_t x
Definition: blobs.h:73
EDGEPT * next
Definition: blobs.h:171
const ICOORD & start_pos() const
Definition: coutln.h:148
int8_t get_dir() const
Definition: mod128.h:76
integer coordinate
Definition: points.h:31
TPOINT pos
Definition: blobs.h:165
int16_t y() const
access_function
Definition: points.h:56
int16_t y
Definition: blobs.h:74
#define DIR
Definition: polyaprx.cpp:41
DIR128 step_dir(int index) const
Definition: coutln.h:139
int start_step
Definition: blobs.h:175
int32_t pathlength() const
Definition: coutln.h:135
#define RUNLENGTH
Definition: polyaprx.cpp:39
int16_t x() const
access function
Definition: points.h:52
C_OUTLINE * src_outline
Definition: blobs.h:173
#define ASSERT_HOST(x)
Definition: errcode.h:88
Definition: mod128.h:29
#define FLAGS
Definition: polyaprx.cpp:43
VECTOR vec
Definition: blobs.h:166
int count(LIST var_list)
Definition: oldlist.cpp:96
EDGEPT * prev
Definition: blobs.h:172
void fix2 ( EDGEPT start,
int  area 
)

Definition at line 216 of file polyaprx.cpp.

218  {
219  EDGEPT *edgept; /*current point */
220  EDGEPT *edgept1;
221  EDGEPT *loopstart; /*modified start of loop */
222  EDGEPT *linestart; /*start of line segment */
223  int dir1, dir2; /*directions of line */
224  int sum1, sum2; /*lengths in dir1,dir2 */
225  int stopped; /*completed flag */
226  int fixed_count; //no of fixed points
227  int d01, d12, d23, gapmin;
228  TPOINT d01vec, d12vec, d23vec;
229  EDGEPT *edgefix, *startfix;
230  EDGEPT *edgefix0, *edgefix1, *edgefix2, *edgefix3;
231 
232  edgept = start; /*start of loop */
233  while (((edgept->flags[DIR] - edgept->prev->flags[DIR] + 1) & 7) < 3
234  && (dir1 =
235  (edgept->prev->flags[DIR] - edgept->next->flags[DIR]) & 7) != 2
236  && dir1 != 6)
237  edgept = edgept->next; /*find suitable start */
238  loopstart = edgept; /*remember start */
239 
240  stopped = 0; /*not finished yet */
241  edgept->flags[FLAGS] |= FIXED; /*fix it */
242  do {
243  linestart = edgept; /*possible start of line */
244  dir1 = edgept->flags[DIR]; /*first direction */
245  /*length of dir1 */
246  sum1 = edgept->flags[RUNLENGTH];
247  edgept = edgept->next;
248  dir2 = edgept->flags[DIR]; /*2nd direction */
249  /*length in dir2 */
250  sum2 = edgept->flags[RUNLENGTH];
251  if (((dir1 - dir2 + 1) & 7) < 3) {
252  while (edgept->prev->flags[DIR] == edgept->next->flags[DIR]) {
253  edgept = edgept->next; /*look at next */
254  if (edgept->flags[DIR] == dir1)
255  /*sum lengths */
256  sum1 += edgept->flags[RUNLENGTH];
257  else
258  sum2 += edgept->flags[RUNLENGTH];
259  }
260 
261  if (edgept == loopstart)
262  stopped = 1; /*finished */
263  if (sum2 + sum1 > 2
264  && linestart->prev->flags[DIR] == dir2
265  && (linestart->prev->flags[RUNLENGTH] >
266  linestart->flags[RUNLENGTH] || sum2 > sum1)) {
267  /*start is back one */
268  linestart = linestart->prev;
269  linestart->flags[FLAGS] |= FIXED;
270  }
271 
272  if (((edgept->next->flags[DIR] - edgept->flags[DIR] + 1) & 7) >= 3
273  || (edgept->flags[DIR] == dir1 && sum1 >= sum2)
274  || ((edgept->prev->flags[RUNLENGTH] < edgept->flags[RUNLENGTH]
275  || (edgept->flags[DIR] == dir2 && sum2 >= sum1))
276  && linestart->next != edgept))
277  edgept = edgept->next;
278  }
279  /*sharp bend */
280  edgept->flags[FLAGS] |= FIXED;
281  }
282  /*do whole loop */
283  while (edgept != loopstart && !stopped);
284 
285  edgept = start;
286  do {
287  if (((edgept->flags[RUNLENGTH] >= 8) &&
288  (edgept->flags[DIR] != 2) && (edgept->flags[DIR] != 6)) ||
289  ((edgept->flags[RUNLENGTH] >= 8) &&
290  ((edgept->flags[DIR] == 2) || (edgept->flags[DIR] == 6)))) {
291  edgept->flags[FLAGS] |= FIXED;
292  edgept1 = edgept->next;
293  edgept1->flags[FLAGS] |= FIXED;
294  }
295  edgept = edgept->next;
296  }
297  while (edgept != start);
298 
299  edgept = start;
300  do {
301  /*single fixed step */
302  if (edgept->flags[FLAGS] & FIXED && edgept->flags[RUNLENGTH] == 1
303  /*and neighours free */
304  && edgept->next->flags[FLAGS] & FIXED && (edgept->prev->flags[FLAGS] & FIXED) == 0
305  /*same pair of dirs */
306  && (edgept->next->next->flags[FLAGS] & FIXED) == 0 && edgept->prev->flags[DIR] == edgept->next->flags[DIR] && edgept->prev->prev->flags[DIR] == edgept->next->next->flags[DIR]
307  && ((edgept->prev->flags[DIR] - edgept->flags[DIR] + 1) & 7) < 3) {
308  /*unfix it */
309  edgept->flags[FLAGS] &= ~FIXED;
310  edgept->next->flags[FLAGS] &= ~FIXED;
311  }
312  edgept = edgept->next; /*do all points */
313  }
314  while (edgept != start); /*until finished */
315 
316  stopped = 0;
317  if (area < 450)
318  area = 450;
319 
320  gapmin = area * fixed_dist * fixed_dist / 44000;
321 
322  edgept = start;
323  fixed_count = 0;
324  do {
325  if (edgept->flags[FLAGS] & FIXED)
326  fixed_count++;
327  edgept = edgept->next;
328  }
329  while (edgept != start);
330  while ((edgept->flags[FLAGS] & FIXED) == 0)
331  edgept = edgept->next;
332  edgefix0 = edgept;
333 
334  edgept = edgept->next;
335  while ((edgept->flags[FLAGS] & FIXED) == 0)
336  edgept = edgept->next;
337  edgefix1 = edgept;
338 
339  edgept = edgept->next;
340  while ((edgept->flags[FLAGS] & FIXED) == 0)
341  edgept = edgept->next;
342  edgefix2 = edgept;
343 
344  edgept = edgept->next;
345  while ((edgept->flags[FLAGS] & FIXED) == 0)
346  edgept = edgept->next;
347  edgefix3 = edgept;
348 
349  startfix = edgefix2;
350 
351  do {
352  if (fixed_count <= 3)
353  break; //already too few
354  point_diff (d12vec, edgefix1->pos, edgefix2->pos);
355  d12 = LENGTH (d12vec);
356  // TODO(rays) investigate this change:
357  // Only unfix a point if it is part of a low-curvature section
358  // of outline and the total angle change of the outlines is
359  // less than 90 degrees, ie the scalar product is positive.
360  // if (d12 <= gapmin && SCALAR(edgefix0->vec, edgefix2->vec) > 0) {
361  if (d12 <= gapmin) {
362  point_diff (d01vec, edgefix0->pos, edgefix1->pos);
363  d01 = LENGTH (d01vec);
364  point_diff (d23vec, edgefix2->pos, edgefix3->pos);
365  d23 = LENGTH (d23vec);
366  if (d01 > d23) {
367  edgefix2->flags[FLAGS] &= ~FIXED;
368  fixed_count--;
369  }
370  else {
371  edgefix1->flags[FLAGS] &= ~FIXED;
372  fixed_count--;
373  edgefix1 = edgefix2;
374  }
375  }
376  else {
377  edgefix0 = edgefix1;
378  edgefix1 = edgefix2;
379  }
380  edgefix2 = edgefix3;
381  edgept = edgept->next;
382  while ((edgept->flags[FLAGS] & FIXED) == 0) {
383  if (edgept == startfix)
384  stopped = 1;
385  edgept = edgept->next;
386  }
387  edgefix3 = edgept;
388  edgefix = edgefix2;
389  }
390  while ((edgefix != startfix) && (!stopped));
391 }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
EDGEPT * next
Definition: blobs.h:171
#define LENGTH(a)
Definition: vecfuncs.h:65
TPOINT pos
Definition: blobs.h:165
#define DIR
Definition: polyaprx.cpp:41
Definition: blobs.h:52
Definition: blobs.h:78
#define RUNLENGTH
Definition: polyaprx.cpp:39
#define fixed_dist
Definition: polyaprx.cpp:45
#define FIXED
Definition: polyaprx.cpp:37
#define FLAGS
Definition: polyaprx.cpp:43
#define point_diff(p, p1, p2)
Definition: vecfuncs.h:37
EDGEPT * prev
Definition: blobs.h:172
EDGEPT* poly2 ( EDGEPT startpt,
int  area 
)

Definition at line 401 of file polyaprx.cpp.

404  {
405  EDGEPT *edgept; /*current outline point */
406  EDGEPT *loopstart; /*starting point */
407  EDGEPT *linestart; /*start of line */
408  int edgesum; /*correction count */
409 
410  if (area < 1200)
411  area = 1200; /*minimum value */
412 
413  loopstart = nullptr; /*not found it yet */
414  edgept = startpt; /*start of loop */
415 
416  do {
417  /*current point fixed */
418  if (edgept->flags[FLAGS] & FIXED
419  /*and next not */
420  && (edgept->next->flags[FLAGS] & FIXED) == 0) {
421  loopstart = edgept; /*start of repoly */
422  break;
423  }
424  edgept = edgept->next; /*next point */
425  }
426  while (edgept != startpt); /*until found or finished */
427 
428  if (loopstart == nullptr && (startpt->flags[FLAGS] & FIXED) == 0) {
429  /*fixed start of loop */
430  startpt->flags[FLAGS] |= FIXED;
431  loopstart = startpt; /*or start of loop */
432  }
433  if (loopstart) {
434  do {
435  edgept = loopstart; /*first to do */
436  do {
437  linestart = edgept;
438  edgesum = 0; /*sum of lengths */
439  do {
440  /*sum lengths */
441  edgesum += edgept->flags[RUNLENGTH];
442  edgept = edgept->next; /*move on */
443  }
444  while ((edgept->flags[FLAGS] & FIXED) == 0
445  && edgept != loopstart && edgesum < 126);
446  if (poly_debug)
447  tprintf
448  ("Poly2:starting at (%d,%d)+%d=(%d,%d),%d to (%d,%d)\n",
449  linestart->pos.x, linestart->pos.y, linestart->flags[DIR],
450  linestart->vec.x, linestart->vec.y, edgesum, edgept->pos.x,
451  edgept->pos.y);
452  /*reapproximate */
453  cutline(linestart, edgept, area);
454 
455  while ((edgept->next->flags[FLAGS] & FIXED)
456  && edgept != loopstart)
457  edgept = edgept->next; /*look for next non-fixed */
458  }
459  /*do all the loop */
460  while (edgept != loopstart);
461  edgesum = 0;
462  do {
463  if (edgept->flags[FLAGS] & FIXED)
464  edgesum++;
465  edgept = edgept->next;
466  }
467  //count fixed pts
468  while (edgept != loopstart);
469  if (edgesum < 3)
470  area /= 2; //must have 3 pts
471  }
472  while (edgesum < 3);
473  do {
474  linestart = edgept;
475  do {
476  edgept = edgept->next;
477  }
478  while ((edgept->flags[FLAGS] & FIXED) == 0);
479  linestart->next = edgept;
480  edgept->prev = linestart;
481  linestart->vec.x = edgept->pos.x - linestart->pos.x;
482  linestart->vec.y = edgept->pos.y - linestart->pos.y;
483  }
484  while (edgept != loopstart);
485  }
486  else
487  edgept = startpt; /*start of loop */
488 
489  loopstart = edgept; /*new start */
490  return loopstart; /*correct exit */
491 }
char flags[EDGEPTFLAGS]
Definition: blobs.h:170
int16_t x
Definition: blobs.h:73
void cutline(EDGEPT *first, EDGEPT *last, int area)
Definition: polyaprx.cpp:499
EDGEPT * next
Definition: blobs.h:171
TPOINT pos
Definition: blobs.h:165
int16_t y
Definition: blobs.h:74
#define DIR
Definition: polyaprx.cpp:41
Definition: blobs.h:78
#define RUNLENGTH
Definition: polyaprx.cpp:39
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:36
#define FIXED
Definition: polyaprx.cpp:37
#define FLAGS
Definition: polyaprx.cpp:43
VECTOR vec
Definition: blobs.h:166
EDGEPT * prev
Definition: blobs.h:172

Variable Documentation

const int par1 = 4500 / (approx_dist * approx_dist)

Definition at line 48 of file polyaprx.cpp.

const int par2 = 6750 / (approx_dist * approx_dist)

Definition at line 49 of file polyaprx.cpp.