, Visual C#


- 3


// LevelCurves:

x2 = x0; y2 = y0;

// do-while break:

int i = 0;

do

{

x1 = x2; y1 = y2;

// :

Gradient(x2, y2, ref dx, ref dy);

if ((Math.Abs(dx) + Math.Abs(dy)) < 0.001) break;

x2 = x2 + dy * step_size;

y2 = y2 - dx * step_size;

FindPointOnCurve(ref x2, ref y2,

LevelCurves, x2, y2, tolerance);

// :

g.DrawLine(myPen, x1, y1, x2, y2);

num_points = num_points + 1;

//,

// :

if (x2 < x_min) break;

if (x2 > x_max) break;

if (y2 < y_min) break;

if (y2 > y_max) break;

// 4 ,

// :

if (num_points >= 4)

{

if (Math.Sqrt((x0 - x2) * (x0 - x2) +

(y0 - y2) * (y0 - y2)) <= step_size * 1.1)

{

g.DrawLine(myPen, x2, y2, x0, y0);

break;

}

}

}

while (i < 1);

}

, Visual C# .

.