, Visual C#


         

double x, double y, double


// :
public double[] trans_coord = new double[4];
// :
public myClassPoint3D()
{
}
// :
public myClassPoint3D( double x, double y, double z)
{
orig_coord[0] = x;
orig_coord[1] = y;
orig_coord[2] = z;
double myScale;
myScale = 1; //.
orig_coord[3] = myScale;
}
// (transformation matrix):
bool normalize = true;
public void Transformation(myClassMatrix3D matrix)
{
double value = 0;
myClassPoint3D result = new myClassPoint3D();
int i, j;
for (i = 0; i <= 3; i++)
{
value = 0;
for (j = 0; j <= 3; j++)
value = value + orig_coord[j] * matrix.M[j, i];
trans_coord[i] = value;
}
// :
if (normalize == true)
{
// value = trans_coord[4]:
trans_coord[0] = trans_coord[0] / value;
trans_coord[1] = trans_coord[1] / value;
trans_coord[2] = trans_coord[2] / value;
trans_coord[3] = 1;
}
}
} // public class myClassPoint3D.
//
// :
public class myClassMatrix3D
{
// (matrix) 4x4:
public double[,] M = new double[4, 4];
// :
public myClassMatrix3D()
{
}
// , :
public myClassMatrix3D(
double m00, double m01, double m02, double m03,
double m10, double m11, double m12, double m13,
double m20, double m21, double m22, double m23,