' COPYRIGHT DASSAULT SYSTEMES 2001
Option Explicit
' ***********************************************************************
' Purpose : Copy and paste products while keeping their absolute position.
' Assumptions : Products to copy/paste have to be selected.
' Author :
' Languages : VBScript
' Locales : English
' CATIA Level : V5R7
' ***********************************************************************
' ***********************************************************************
'
' Purpose: Define the product of two matrix.
'
' Inputs : matrix1 Array array corresponding to the first matrix
' matrix2 Array array corresponding to the second matrix
'
' Outputs: res Array array corresponding to the product
'
' ***********************************************************************
Sub MatrixProduct ( ByVal matrix1, ByVal matrix2, ByRef res )
Dim a(11)
Dim b(11)
Dim I As Integer
For I = 0 to 11
a(I) = matrix1(I)
b(I) = matrix2(I)
Next
res( 0) = a(0)*b(0) + a(1)*b(3) + a(2)*b(6)
res( 3) = a(3)*b(0) + a(4)*b(3) + a(5)*b(6)
res( 6) = a(6)*b(0) + a(7)*b(3) + a(8)*b(6)
res( 1) = a(0)*b(1) + a(1)*b(4) + a(2)*b(7)
res( 4) = a(3)*b(1) + a(4)*b(4) + a(5)*b(7)
res( 7) = a(6)*b(1) + a(7)*b(4) + a(8)*b(7)
res( 2) = a(0)*b(2) + a(1)*b(5) + a(2)*b(8)
res( 5) = a(3)*b(2) + a(4)*b(5) + a(5)*b(8)
res( 8) = a(6)*b(2) + a(7)*b(5) + a(8)*b(8)
res( 9) = a( 9)*b(0) + a(10)*b(3) + a(11)*b(6) + b( 9)
res(10) = a( 9)*b(1) + a(10)*b(4) + a(11)*b(7) + b(10)
res(11) = a( 9)*b(2) + a(10)*b(5) + a(11)*b(8) + b(11)
End Sub
' ***********************************************************************
'
' Purpose: Define the inverse of a position matrix.
'
' Inputs : matrix Array array corresponding to the matrix
'
' Outputs: inverse Array array corresponding to the inverse of the matrix
'
' ***********************************************************************
Sub MatrixInverse ( ByVal matrix, ByRef inverse )
Dim a(11)
Dim I As Integer
For I = 0 to 11
a(I) = matrix(I)
Next
inverse( 0) = a(4)*a(8) - a(7)*a(5)
inverse( 1) = a(2)*a(7) - a(8)*a(1)
inverse( 2) = a(1)*a(5) - a(4)*a(2)
inverse( 3) = a(5)*a(6) - a(8)*a(3)
inverse( 4) = a(0)*a(8) - a(6)*a(2)
inverse( 5) = a(2)*a(3) - a(5)*a(0)
inverse( 6) = a(3)*a(7) - a(6)*a(4)
inverse( 7) = a(1)*a(6) - a(7)*a(0)
inverse( 8) = a(0)*a(4) - a(1)*a(3)
inverse( 9) = -(a( 9)*inverse(0)+a(10)*inverse(3)+a(11)*inverse(6))
inverse(10) = -(a( 9)*inverse(1)+a(10)*inverse(4)+a(11)*inverse(7))
inverse(11) = -(a( 9)*inverse(2)+a(10)*inverse(5)+a(11)*inverse(8))
End Sub
' ***********************************************************************
'
' Purpose: Print the content of a matrix.
'
' Inputs : sName String name of the matrix
' matrix Array array corresponding to the matrix
'
' ***********************************************************************
Sub MatrixPrint ( ByVal sName, ByVal matrix )
Dim a(11)
Dim I As Integer
For I = 0 to 11
If ((matrix(I) < 0.001) AND (matrix(I) > -0.001)) Then
a