{
double *coeffs;
float ydiff;
float x_centre;
C_BLOB_IT blob_it;
blob_count = 0;
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
}
if (blob_count == 0)
return;
xstarts =
coeffs =
(
double *)
alloc_mem ((blob_count + row->baseline.segments) * 3 *
sizeof (double));
src_index = 0;
dest_index = 0;
xstarts[0] = row->baseline.xcoords[0];
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list ();
blob_it.forward ()) {
blob = blob_it.data ();
x_centre = (blob_box.
left () + blob_box.
right ()) / 2.0;
if (ydiff < 0)
else
if (ydiff < blshift_maxshift
if (xstarts[dest_index] >= x_centre)
xstarts[dest_index] = blob_box.
left ();
coeffs[dest_index * 3] = 0;
coeffs[dest_index * 3 + 1] = 0;
coeffs[dest_index * 3 + 2] = blob_box.
bottom ();
dest_index++;
xstarts[dest_index] = blob_box.
right () + 1;
}
else {
if (xstarts[dest_index] <= x_centre) {
while (row->baseline.xcoords[src_index + 1] <= x_centre
&& src_index < row->
baseline.segments - 1) {
if (row->baseline.xcoords[src_index + 1] >
xstarts[dest_index]) {
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].
a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].
b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].
c;
dest_index++;
xstarts[dest_index] =
row->baseline.xcoords[src_index + 1];
}
src_index++;
}
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].
a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].
b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].
c;
dest_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index + 1];
}
}
}
}
while (src_index < row->
baseline.segments
&& row->baseline.xcoords[src_index + 1] <= xstarts[dest_index])
src_index++;
while (src_index < row->
baseline.segments) {
coeffs[dest_index * 3] = row->baseline.quadratics[src_index].
a;
coeffs[dest_index * 3 + 1] = row->baseline.quadratics[src_index].
b;
coeffs[dest_index * 3 + 2] = row->baseline.quadratics[src_index].
c;
dest_index++;
src_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index];
}
row->baseline =
QSPLINE (dest_index, xstarts, coeffs);
}