<< Prev        Next >>

ID : 257

NormTrn

Function

To return a result of the normalization calculation of homogeneous translation type data.

Syntax

 NormTrn(homogeneous translation type data)

Guaranteed entry

Homogeneous translation type data
Designate Homogeneous Translation Type data.

Return value

Return a result of the normalization calculation by homogeneous translation type data.

Description

Normalize Homogeneous Translation Type data.

Orthogonalize an orient vector with an approach vector as a reference. Then, unit-vectorize both the approach and orient vector.

If the designated homogeneous translation type data is data that cannot be normalized, an Error level 1 occurs. You can create an error processing routine using "On Error" statement. Refer to "On Error."

Related Terms

TNorm

Attention

-

Example

'!TITLE "Normalization Calculation of Homogeneous Translation Type Data"
' Display 1 if the normalization calculation result is correct, and -1 if it is not correct on the message output window
Sub Sample_Normtrn

  Dim aaa As Trans
  Dim bbb As Trans
  Dim ccc As Vector
  Dim ddd As Vector
  Dim eee( 11 ) As Integer

  aaa = T( 1, 0, 1, 0.5, 0, 0, 0, 0, 2 )

  ' Assign the normalization calculation of aaa to bbb
  bbb = NormTrn( aaa )

  ' Assign the orient vector in bbb to ccc
  ccc = OVec( bbb )

  ' Assign the approach vector in bbb to ddd
  ddd = AVec( bbb )

  If PosX( bbb ) = 0 Then eee( 0 ) = 1 Else eee( 0 ) = 0
  PrintDbg " eee(0)=" + Str( eee( 0 ) ) + ",  " + Str( PosX( bbb ) )
  If PosY( bbb ) = 0 Then eee( 1 ) = 1 Else eee( 1 ) = 0
  PrintDbg " eee(1)=" + Str( eee( 1 ) ) + ",  " + Str( PosY( bbb ) )
  If PosZ( bbb ) = 0 Then eee( 2 ) = 1 Else eee( 2 ) = 0
  PrintDbg " eee(2)=" + Str( eee( 2 ) ) + ",  " + Str( PosZ( bbb ) )
  If PosX( ccc ) = 1 Then eee( 3 ) = 1 Else eee( 3 ) = 0
  PrintDbg " eee(3)=" + Str( eee( 3 ) ) + ",  " + Str( PosX( ccc ) )
  If PosY( ccc ) = 0 Then eee( 4 ) = 1 Else eee( 4 ) = 0
  PrintDbg " eee(4)=" + Str( eee( 4 ) ) + ",  " + Str( PosY( ccc ) )
  If PosZ( ccc ) = 0 Then eee( 5 ) = 1 Else eee( 5 ) = 0
  PrintDbg " eee(5)=" + Str( eee( 5 ) ) + ",  " + Str( PosZ( ccc ) )
  If PosX( ddd ) = 0 Then eee( 6 ) = 1 Else eee( 6 ) = 0
  PrintDbg " eee(6)=" + Str( eee( 6 ) ) + ",  " + Str( PosX( ddd ) )
  If PosY( ddd ) = 0 Then eee( 7 ) = 1 Else eee( 7 ) = 0
  PrintDbg " eee(7)=" + Str( eee( 7 ) ) + ",  " + Str( PosY( ddd ) )
  If PosZ( ddd ) = 1 Then eee( 8 ) = 1 Else eee( 8 ) = 0
  PrintDbg " eee(8)=" + Str( eee( 8 ) ) + ",  " + Str( PosZ( ddd ) )
  If Fig( bbb ) = -1 Then eee( 9 ) = 1 Else eee( 9 ) = 0
  PrintDbg " eee(9)=" + Str( eee( 9 ) ) + ",  " + Str( Fig( bbb ) )

  eee( 10 ) = eee( 0 ) + eee( 1 ) + eee( 2 ) + eee( 3 ) + eee( 4 ) + eee( 5 ) + eee( 6 ) + eee( 7 ) + eee( 8 ) + eee( 9 )

  ' Judge whether the normalization is correct or not
  If eee( 10 ) = 10 Then eee( 11 ) = 1 Else eee( 11 ) = -1

  ' Display a value of eee(11) on the message output window
  PrintDbg " eee(11)=" + Str( eee( 11 ) )

End Sub

ID : 257

<< Prev        Next >>