, Visual C#


- 8


double m30, double m31, double m32, double m33)

{

M[0, 0] = m00; M[0, 1] = m01;

M[0, 2] = m02; M[0, 3] = m03;

M[1, 0] = m10; M[1, 1] = m11;

M[1, 2] = m12; M[1, 3] = m13;

M[2, 0] = m20; M[2, 1] = m21;

M[2, 2] = m22; M[2, 3] = m23;

M[3, 0] = m30; M[3, 1] = m31;

M[3, 2] = m32; M[3, 3] = m33;

}

// :

public myClassMatrix3D TimesMatrix(

myClassMatrix3D right_matrix)

{

myClassMatrix3D result = new myClassMatrix3D();

double value; int i, j, k;

for (i = 0; i <= 3; i++)

{

for (j = 0; j <= 3; j++)

{

value = 0;

for (k = 0; k <= 3; k++)

{

value = value + M[i, k] *

right_matrix.M[k, j];

}

result.M[i, j] = value;

}

}

return result;

}

// z

// y-z :

public static myClassMatrix3D GetZRotPointToYZ(

myClassPoint3D pt)

{

double R = Math.Sqrt(

pt.orig_coord[0] * pt.orig_coord[0] +

pt.orig_coord[1] * pt.orig_coord[1]);

double stheta = pt.orig_coord[0] / R;

double ctheta = pt.orig_coord[1] / R;

return new myClassMatrix3D(

ctheta, stheta, 0, 0,

-stheta, ctheta, 0, 0,

0, 0, 1, 0,

0, 0, 0, 1);

}

// x z:

public static myClassMatrix3D

GetXRotPointToZ(myClassPoint3D pt)

{

double R1 = Math.Sqrt(

pt.orig_coord[0] * pt.orig_coord[0] +

pt.orig_coord[1] * pt.orig_coord[1]);

double R2 = Math.Sqrt(

pt.orig_coord[0] * pt.orig_coord[0] +

pt.orig_coord[1] * pt.orig_coord[1] +

pt.orig_coord[2] * pt.orig_coord[2]);

double sphi = -R1 / R1;

double cphi = -pt.orig_coord[2] / R2;

return new myClassMatrix3D(

1, 0, 0, 0,

0, cphi, sphi, 0,

0, -sphi, cphi, 0,

0, 0, 0, 1);

}

} // class myClassMatrix3D.