public void Draw(double A, double B, double C)
{
double a, b, c;
a = A;
b = B;
c = C;
double temp, y;
double lastx = 300, lasty = 300;
bool ind = false;
double x1 = 0;
double x2 = 0;
double x3 = 0;
double x4 = 0;
double x5 = 0;
double x6 = 0;
double y1 = 0;
double y2 = 0;
double y3 = 0;
double y4 = 0;
double y5 = 0;
double y6 = 0;
double x7 = 0;
double x8 = 0;
double y7 = 0;
double y8 = 0;
double xd, yd;
double S = 0;
for (int i = -1; i <= 1; i += 2)
{
ind = false;
for (int j = -1; j <= 1; j += 2)
{
ind = false;
if (j == 1)
{
if (i == -1)
{
x5 = lastx;
y5 = lasty;
}
if (i == 1)
{
x6 = lastx;
y6 = lasty;
}
}
for (double x = -300; x <= 300; x += 0.01)
{
temp = f2(x, a, b, c);
if (temp < 0) continue;
y = f1(x, a, b, c) + j * 2 * Math.Sqrt(temp);
if (y < 0) continue;
xd = x * 15 + 300;
yd = (i * 15 * 0.5 * Math.Sqrt(y)) + 300;
if (ind == false)
{
lastx = xd;
lasty = yd;
ind = true;
drawLines();
points.Clear();
if (i == -1 && j == 1)
{
x2 = xd;
y2 = yd;
}
if (i == 1 && j == 1)
{
x4 = xd;
y4 = yd;
}
if (i == -1 && j == -1)
{
x1 = xd;
y1 = yd;
}
if (i == 1 && j == -1)
{
x3 = xd;
y3 = yd;
}
}
else
{
start = new Point3D(lastx, lasty, 0);
points.Push(start);
end = new Point3D(xd, yd, 0);
points.Push(end);
double H = Math.Abs(xd - lastx);
double sA = Math.Abs(300 - lasty);
double sB = Math.Abs(300 - xd);
S += (sA + sB) / 2 * H;
lastx = x * 15 + 300;
lasty = (i * 15 * 0.5 * Math.Sqrt(y)) + 300;
if (i == -1 && j == 1)
{
double temp2 = f2(x + 0.01, a, b, c);
if (temp2 < 0)
{
x7 = lastx;
y7 = lasty;
}
else
{
y = f1(x, a, b, c) + j * 2 * Math.Sqrt(temp);
if (y < 0)
{
x7 = lastx;
y7 = lasty;
}
}
}
if (i == 1 && j == 1)
{
double temp2 = f2(x + 0.01, a, b, c);
if (temp2 < 0)
{
x8 = lastx;
y8 = lasty;
}
else
{
y = f1(x, a, b, c) + j * 2 * Math.Sqrt(temp);
if (y < 0)
{
x8 = lastx;
y8 = lasty;
}
}
}
}
}
}
}
drawLines();
points.Clear();
start = new Point3D(x1, y1, 0);
points.Push(start);
end = new Point3D(x2, y2, 0);
points.Push(end);
drawLines();
points.Clear();
start = new Point3D(x3, y3, 0);
points.Push(start);
end = new Point3D(x4, y4, 0);
points.Push(end);
drawLines();
points.Clear();
start = new Point3D(x5, y5, 0);
points.Push(start);
end = new Point3D(x6, y6, 0);
points.Push(end);
drawLines();
points.Clear();
start = new Point3D(x7, y7, 0);
points.Push(start);
end = new Point3D(x8, y8, 0);
points.Push(end);
drawLines();
worker.Draw();
}
heh mda
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.