Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

SIG_TypeConverter.cpp

00001 #include "SIGEL_Tools/SIG_TypeConverter.h"
00002 
00003 namespace SIGEL_Tools
00004 {
00005 
00006   DL_vector SIG_TypeConverter::toDL_vector( NEWMAT::ColumnVector input )
00007   {
00008     DL_vector result;
00009 
00010     for (int i=0; i<3; i++)
00011       result.set( i, input( i+1 ) );
00012 
00013     return result;
00014   };
00015 
00016   DL_vector SIG_TypeConverter::toDL_vector( CartesianVector const input )
00017   {
00018     DL_vector result;
00019 
00020     for (int i=0; i<3; i++)
00021       result.set( i, input[i] );
00022 
00023     return result;
00024   };
00025 
00026   NEWMAT::ColumnVector SIG_TypeConverter::toColumnVector( DL_vector input )
00027   {
00028     NEWMAT::ColumnVector result( 3 );
00029 
00030     for (int i=0; i<3; i++)
00031       result( i+1 ) = input.get( i );
00032 
00033     return result;
00034   };
00035 
00036   NEWMAT::ColumnVector SIG_TypeConverter::toColumnVector( CartesianVector const input )
00037   {
00038     NEWMAT::ColumnVector result( 3 );
00039 
00040     for (int i=0; i<3; i++)
00041       result( i+1 ) = input[i];
00042 
00043     return result;
00044   };
00045 
00046   void SIG_TypeConverter::toCartesianVector( DL_vector input, CartesianVector result )
00047   {
00048     for (int i=0; i<3; i++)
00049       result[i] = input.get( i );
00050   };
00051 
00052   void SIG_TypeConverter::toCartesianVector( NEWMAT::ColumnVector input, CartesianVector result )
00053   {
00054     for (int i=0; i<3; i++)
00055       result[i] = input( i+1 );
00056   };
00057 
00058   DL_matrix SIG_TypeConverter::toDL_matrix( NEWMAT::Matrix input )
00059   {
00060     DL_matrix result;
00061 
00062     for (int i=0; i<3; i++)
00063       for (int j=0; j<3; j++)
00064         result.set( i, j, input( i+1, j+1 ) );
00065 
00066     return result;
00067   };
00068 
00069   DL_matrix SIG_TypeConverter::toDL_matrix( RotationMatrix const input )
00070   {
00071     DL_matrix result;
00072 
00073     for (int i=0; i<3; i++)
00074       for (int j=0; j<3; j++)
00075         result.set( i, j, input[j][i] );
00076 
00077     return result;
00078   };
00079 
00080   NEWMAT::Matrix SIG_TypeConverter::toMatrix( DL_matrix input )
00081   {
00082     NEWMAT::Matrix result( 3, 3 );
00083 
00084     for (int i=0; i<3; i++)
00085       for (int j=0; j<3; j++)
00086         result( i+1, j+1 ) = input.get( i, j );
00087 
00088     return result;
00089   };
00090 
00091   NEWMAT::Matrix SIG_TypeConverter::toMatrix( RotationMatrix const input )
00092   {
00093     NEWMAT::Matrix result( 3, 3 );
00094 
00095     for (int i=0; i<3; i++)
00096       for (int j=0; j<3; j++)
00097         result( i+1, j+1 ) = input[j][i];
00098 
00099     return result;
00100   };
00101 
00102   void SIG_TypeConverter::toRotationMatrix( NEWMAT::Matrix input, RotationMatrix result )
00103   {
00104     for (int i=0; i<3; i++)
00105       for (int j=0; j<3; j++)
00106         result[j][i] = input( i+1, j+1 );
00107   };
00108 
00109   void SIG_TypeConverter::toRotationMatrix( DL_matrix input, RotationMatrix result )
00110   {
00111     for (int i=0; i<3; i++)
00112       for (int j=0; j<3; j++)
00113         result[j][i] = input.get( i, j );
00114   };
00115 
00116   NEWMAT::Matrix SIG_TypeConverter::sigelToDynaMechs()
00117   {
00118     NEWMAT::Matrix transformation( 3, 3 );
00119 
00120     transformation << 1 << 0 << 0
00121                    << 0 << 0 << -1
00122                    << 0 << 1 << 0;
00123 
00124     return transformation;
00125   };
00126 
00127   NEWMAT::Matrix SIG_TypeConverter::dynaMechsToSigel()
00128   {
00129     NEWMAT::Matrix transformation( 3, 3 );
00130 
00131     transformation << 1 << 0 << 0
00132                    << 0 << 0 << 1
00133                    << 0 << -1 << 0;
00134 
00135     return transformation; 
00136   };
00137 
00138   NEWMAT::Matrix SIG_TypeConverter::sigelToPovray()
00139   {
00140     NEWMAT::Matrix transformation( 3, 3 );
00141 
00142     transformation << 1 << 0 << 0
00143                    << 0 << 1 << 0
00144                    << 0 << 0 << -1;
00145 
00146     return transformation; 
00147   };
00148 }

Generated at Mon Sep 3 01:32:33 2001 for PG 368 - SIGEL by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000