, Visual C#


- 8


(x2 * bmp.Width / 4) + bmp.Width / 2.0F,

bmp.Height / 2.0F - (y2 * bmp.Height / 4));

}

// g pen:

g.Dispose(); pen.Dispose();

}

// :

public void MatrixIdentity(ref float[,] M)

{

for (int i = 1; i <= 4; i++)

{

for (int j = 1; j <= 4; j++)

{

if (i == j) M[i, j] = 1;

else M[i, j] = 0;

}

}

}

// (3-D transformation matrix)

// z x,y

// ()

// c (0, 0, Distance):

public void MatrixPerspectiveXZ(ref float[,] M,

float Distance)

{

MatrixIdentity(ref M);

if (Distance != 0) M[3, 4] = -1 / Distance;

}

// (3-D transformation matrix)

// :

// (cx, cy, cz), (fx, fy, fx),

// UP <ux, yx, uz>,

// (type_of_projection):

//PerspectiveProjection ParallelProjection:

public void MatrixTransformation(ref float[,] M,

int type_of_projection,

float Cx, float Cy, float Cz,

float Fx, float Fy, float Fz,

float ux, float uy, float uz)

{

float[,] M1 = new float[5, 5];

float[,] M2 = new float[5, 5];

float[,] M3 = new float[5, 5];

float[,] M4 = new float[5, 5];

float[,] M5 = new float[5, 5];

float[,] M12 = new float[5, 5];

float[,] M34 = new float[5, 5];

float[,] M1234 = new float[5, 5];

float sin1 = 0, cos1 = 0; float sin2 = 0, cos2 = 0;

float sin3, cos3; float A, B, C; float d1, d2, d3;

float[] up1 = new float[5]; float[] up2 = new float[5];

// ( ) :

MatrixTranslate(ref M1, -Fx, -Fy, -Fz);

A = Cx - Fx; B = Cy - Fy; C = Cz - Fz;

d1 = (float)Math.Sqrt(A * A + C * C);

if (d1 != 0)




- -  - -  - -