406 int left = 0,
right = 0,
top = 0, bot = 0,old, iNew, i, j, x3, y3;
407 double yy0 = 0, yy1 = 0, xx0 = 0, xx1 = 0, xx3, yy3;
408 double v, f11, f12, f21, f22, f33, fold, fnew, f;
412 if ((x1 == x2) || (y1 == y2))
418 if ((x2 > x1+1) || (y2 > y1+1))
424 if (f33 < f11) i++;
else if (f33 > f11) j++;
425 if (f33 < f12) i++;
else if (f33 > f12) j++;
426 if (f33 < f21) i++;
else if (f33 > f21) j++;
427 if (f33 < f22) i++;
else if (f33 > f22) j++;
428 if ((i > 2) || (j > 2))
431 Pass2(x1, x3, y1, y3);
432 Pass2(x3, x2, y1, y3);
433 Pass2(x1, x3, y3, y2);
434 Pass2(x3, x2, y3, y2);
439 for (i = 0; i < (int)
m_vPlanes.size(); i++)
446 if (f12 > v) j |= 010;
447 if ((f11 > v) ^ (f12 > v))
449 if ((
FnctData(x1,y1)->m_sLeftLen != 0) &&
456 iNew = old+
FnctData(x1,old)->m_sLeftLen;
458 if ((fnew > v) ^ (fold > v))
463 yy0 = ((old-y1)+(iNew-old)*(v-fold)/(fnew-fold))/(y2-y1);
466 yy0 = (v-f11)/(f12-f11);
468 left = (int)(y1+(y2-y1)*yy0+0.5);
470 if ((f21 > v) ^ (f22 > v))
472 if ((
FnctData(x2,y1)->m_sRightLen != 0) &&
479 iNew = old+
FnctData(x2,old)->m_sRightLen;
481 if ((fnew > v) ^ (fold > v))
486 yy1 = ((old-y1)+(iNew-old)*(v-fold)/(fnew-fold))/(y2-y1);
489 yy1 = (v-f21)/(f22-f21);
491 right = (int)(y1+(y2-y1)*yy1+0.5);
493 if ((f21 > v) ^ (f11 > v))
495 if ((
FnctData(x1,y1)->m_sBotLen != 0) &&
500 iNew = old+
FnctData(old,y1)->m_sBotLen;
502 if ((fnew > v) ^ (fold > v))
507 xx0 = ((old-x1)+(iNew-old)*(v-fold)/(fnew-fold))/(x2-x1);
510 xx0 = (v-f11)/(f21-f11);
512 bot = (int)(x1+(x2-x1)*xx0+0.5);
514 if ((f22 > v) ^ (f12 > v))
516 if ((
FnctData(x1,y2)->m_sTopLen != 0) &&
521 iNew = old+
FnctData(old,y2)->m_sTopLen;
523 if ((fnew > v) ^ (fold > v))
528 xx1 = ((old-x1)+(iNew-old)*(v-fold)/(fnew-fold))/(x2-x1);
531 xx1 = (v-f12)/(f22-f12);
533 top = (int)(x1+(x2-x1)*xx1+0.5);
567 yy3 = (xx0*(yy1-yy0)+yy0)/(1.0-(xx1-xx0)*(yy1-yy0));
568 xx3 = yy3*(xx1-xx0)+xx0;
569 xx3 = x1+xx3*(x2-x1);
570 yy3 = y1+yy3*(y2-y1);
571 xx3 = xoff+xx3*
m_dDx;
572 yy3 = yoff+yy3*
m_dDy;
578 if (((f > v) && (f22 > v)) || ((f < v) && (f22 < v))) {