, Visual C#


- 6


case Keys.Up:

phi = phi - delta_phi;

if (phi < -Math.PI / 2) phi = -Math.PI / 2;

break;

case Keys.Right:

theta = theta + delta_theta;

break;

case Keys.Down:

phi = phi + delta_phi;

if (phi > Math.PI / 2) phi = Math.PI / 2;

break;

}

// :

myEye.orig_coord[0] = r1 * Math.Cos(theta);

myEye.orig_coord[1] = r1 * Math.Sin(theta);

myEye.orig_coord[2] = r2 * Math.Sin(phi);

// PictureBox1:

pictureBox1.Invalidate();

return true;

}

.

37.4. CalculateTransformation.

//

// :

myClassMatrix3D CalculateTransformation()

{

// z,

// y-z:

myClassMatrix3D transformation1 =

myClassMatrix3D.GetZRotPointToYZ(myEye);

// x,

// z:

myClassMatrix3D transformation2 =

myClassMatrix3D.GetXRotPointToZ(myEye);

// z, z.

// :

return (transformation1.TimesMatrix(transformation2));

}

Form1:

public partial class Form1 : System.Windows.Forms.Form

{

}

.

37.5. .

//

// :

public class myClassPoint3D

{

// 4-

//(original coordinates); :

public double[] orig_coord = new double[4];