, Visual C#


- 15


r2 = R * CSng(Cos(phi))

Cx = r2 * CSng(Cos(theta))

Cz = r2 * CSng(Sin(theta))

MatrixTransformation(M, type_of_projection, _

Cx, Cy, Cz, Fx, Fy, Fz, ux, uy, uz)

End Sub

' ,

' ,

' (p1, p2, p3) <n1, n2, n3>:

Public Sub m3Reflect(ByRef M(,) As Single, _

ByVal p1 As Single, ByVal p2 As Single, _

ByVal p3 As Single, ByVal n1 As Single, _

ByVal n2 As Single, ByVal n3 As Single)

Dim T(4, 4) As Single '.

Dim R1(4, 4) As Single ' 1.

Dim r2(4, 4) As Single ' 2.

Dim S(4, 4) As Single '.

Dim R2i(4, 4) As Single ' 2.

Dim R1i(4, 4) As Single ' 1.

Dim Ti(4, 4) As Single ' .

Dim D As Single : Dim L As Single

Dim M12(4, 4) As Single : Dim M34(4, 4) As Single

Dim M1234(4, 4) As Single

Dim M56(4, 4) As Single : Dim M567(4, 4) As Single

' :

MatrixTranslate(T, -p1, -p2, -p3)

MatrixTranslate(Ti, p1, p2, p3)

' z,

' y-z :

MatrixIdentity(R1)

D = CSng(Sqrt(n1 * n1 + n2 * n2))

R1(1, 1) = n2 / D : R1(1, 2) = n1 / D

R1(2, 1) = -R1(1, 2) : R1(2, 2) = R1(1, 1)

MatrixIdentity(R1i)

R1i(1, 1) = R1(1, 1) : R1i(1, 2) = -R1(1, 2)

R1i(2, 1) = -R1(2, 1) : R1i(2, 2) = R1(2, 2)

' x, y:

MatrixIdentity(r2)

L = CSng(Sqrt(n1 * n1 + n2 * n2 + n3 * n3))

r2(2, 2) = D / L : r2(2, 3) = -n3 / L

r2(3, 2) = -r2(2, 3) : r2(3, 3) = r2(2, 2)

MatrixIdentity(R2i)

R2i(2, 2) = r2(2, 2) : R2i(2, 3) = -r2(2, 3)

R2i(3, 2) = -r2(3, 2) : R2i(3, 3) = r2(3, 3)

' x-z :