도와주세요!!
글 수 15,339
2003.04.08 14:17:55 (*.144.117.193)
6693
mk712.c 의 static void mk712_store_point(int x_new, int y_new) 함수에서
if (points == 1 && abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) < 88)
.
.
.
위부분에서 88 이 의미하는게 뭔가요?
static void mk712_store_point(int x_new, int y_new)
{
static int x[3], y[3];
int x_out, y_out;
x[points] = x_new;
y[points] = y_new;
if (points == 1 && abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) <
88)
{
x_out = (x[0] + x[1]) >> 1;
y_out = (y[0] + y[1]) >> 1;
mk712_output_point(x_out, y_out);
}
if (points == 2)
{
if ((abs(x[1] - x[2]) < 88 && abs(y[1] - y[2]) < 88) &&
(abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) < 88))
{
x_out = (x[0] + x[1] + x[2]) / 3;
y_out = (y[0] + y[1] + y[2]) / 3;
mk712_output_point(x_out, y_out);
}
else if (abs(x[1] - x[2]) < 88 && abs(y[1] - y[2]) < 88)
{
x_out = (x[1] + x[2]) >> 1;
y_out = (y[1] + y[2]) >> 1;
mk712_output_point(x_out, y_out);
}
else
{
int x_avg, y_avg, d0, d1, d2;
x_avg = (x[0] + x[1] + x[2]) / 3;
y_avg = (y[0] + y[1] + y[2]) / 3;
d0 = SQUARE(x[0] - x_avg) + SQUARE(y[0] - y_avg);
d1 = SQUARE(x[1] - x_avg) + SQUARE(y[1] - y_avg);
d2 = SQUARE(x[2] - x_avg) + SQUARE(y[2] - y_avg);
if (d2 > d1 && d2 > d0)
{
x_out = (x[0] + x[1]) >> 1;
y_out = (y[0] + y[1]) >> 1;
}
if (d1 > d0 && d1 > d2)
{
x_out = (x[0] + x[2]) >> 1;
y_out = (y[0] + y[2]) >> 1;
}
else
{
x_out = (x[1] + x[2]) >> 1;
y_out = (y[1] + y[2]) >> 1;
}
mk712_output_point(x_out, y_out);
x[0] = x[1];
x[1] = x[2];
y[0] = y[1];
y[1] = y[2];
}
}
else
{
points++;
}
}
if (points == 1 && abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) < 88)
.
.
.
위부분에서 88 이 의미하는게 뭔가요?
static void mk712_store_point(int x_new, int y_new)
{
static int x[3], y[3];
int x_out, y_out;
x[points] = x_new;
y[points] = y_new;
if (points == 1 && abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) <
88)
{
x_out = (x[0] + x[1]) >> 1;
y_out = (y[0] + y[1]) >> 1;
mk712_output_point(x_out, y_out);
}
if (points == 2)
{
if ((abs(x[1] - x[2]) < 88 && abs(y[1] - y[2]) < 88) &&
(abs(x[0] - x[1]) < 88 && abs(y[0] - y[1]) < 88))
{
x_out = (x[0] + x[1] + x[2]) / 3;
y_out = (y[0] + y[1] + y[2]) / 3;
mk712_output_point(x_out, y_out);
}
else if (abs(x[1] - x[2]) < 88 && abs(y[1] - y[2]) < 88)
{
x_out = (x[1] + x[2]) >> 1;
y_out = (y[1] + y[2]) >> 1;
mk712_output_point(x_out, y_out);
}
else
{
int x_avg, y_avg, d0, d1, d2;
x_avg = (x[0] + x[1] + x[2]) / 3;
y_avg = (y[0] + y[1] + y[2]) / 3;
d0 = SQUARE(x[0] - x_avg) + SQUARE(y[0] - y_avg);
d1 = SQUARE(x[1] - x_avg) + SQUARE(y[1] - y_avg);
d2 = SQUARE(x[2] - x_avg) + SQUARE(y[2] - y_avg);
if (d2 > d1 && d2 > d0)
{
x_out = (x[0] + x[1]) >> 1;
y_out = (y[0] + y[1]) >> 1;
}
if (d1 > d0 && d1 > d2)
{
x_out = (x[0] + x[2]) >> 1;
y_out = (y[0] + y[2]) >> 1;
}
else
{
x_out = (x[1] + x[2]) >> 1;
y_out = (y[1] + y[2]) >> 1;
}
mk712_output_point(x_out, y_out);
x[0] = x[1];
x[1] = x[2];
y[0] = y[1];
y[1] = y[2];
}
}
else
{
points++;
}
}