public void PlotSurface double x1 double y1 double x2 double y2 double

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
public void PlotSurface(double x1, double y1, double x2, double y2, double fmin, double fmax, int n1, int n2, int Dx, int Dy, Graphics g)
{
Point[] CurLine = new Point[n1];
double phi = Phi * Math.PI / 180;
double psi = Psi * Math.PI / 180;
double sphi = Math.Sin(phi);
double spsi = Math.Sin(psi);
double cphi = Math.Cos(phi);
double cpsi = Math.Cos(psi);
double[] e1 = new double[3] { cphi, sphi, 0 };
double[] e2 = new double[3] { spsi * sphi, -spsi * cphi, cpsi };
double x, y;
double hx = (x2 - x1) / n1;
double hy = (y2 - y1) / n2;
double xmin = (e1[0] >= 0 ? x1 : x2) * e1[0] +
(e1[1] >= 0 ? y1 : y2) * e1[1];
double xmax = (e1[0] >= 0 ? x2 : x1) * e1[0] +
(e1[1] >= 0 ? y2 : y1) * e1[1];
double ymin = (e2[0] >= 0 ? x1 : x2) * e2[0] +
(e2[1] >= 0 ? y1 : y2) * e2[1];
double ymax = (e2[0] >= 0 ? x2 : x1) * e2[0] +
(e2[1] >= 0 ? y2 : y1) * e2[1];
int i, j;
if (e2[2] >= 0)
{
ymin += fmin * e2[2];
ymax += fmax * e2[2];
}
else
{
ymin += fmax * e2[2];
ymax += fmin * e2[2];
}
double ax = Dx - (MAXX - 40) * xmin / (xmax - xmin);
double bx = (MAXX - 40) / (xmax - xmin);
double ay = Dy - (MAXY - 80) * ymin / (ymax - ymin);
double by = -(MAXY - 80) / (ymax - ymin);
for (i = 0; i < MAXX; i++)
YMin[i] = YMax[i] = 0;
for (i = n2 - 1; i > -1; i--)
{
for (j = 0; j < n1; j++)
{
x = x1 + j * hx;
y = y1 + i * hy;
CurLine[j].X = (int)(ax + bx * (x * e1[0] + y * e1[1]));
CurLine[j].Y = (int)(ay + by * (x * e2[0] + y * e2[1] +
f(x, y) * e2[2]));
}
for (j = 0; j < n1 - 1; j++)
DrawLine(CurLine[j], CurLine[j + 1], g);
///g.DrawLine(new Pen(Color.Black), CurLine[j], CurLine[j + 1]);
}
}