Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
testshear.c
Go to the documentation of this file.00001 #include "thd_shear3d.h"
00002 #include "mrilib.h"
00003
00004 int main( int argc , char *argv[] )
00005 {
00006 float th1=0.0, th2=0.0, th3=0.0 , thx,thy,thz ;
00007 int iarg=0 ;
00008 MCW_3shear shr ;
00009 double ntop , nnow ;
00010
00011 if( argc == 2 && strcmp(argv[1],"-help") == 0 ){
00012 printf("Usage: testshear [a b c]\n") ; exit(0) ;
00013 }
00014
00015 if( argc > 2 ){
00016 th1 = (PI/180.0) * strtod( argv[++iarg] , NULL ) ;
00017 th2 = (PI/180.0) * strtod( argv[++iarg] , NULL ) ;
00018 th3 = (PI/180.0) * strtod( argv[++iarg] , NULL ) ;
00019 shr = rot_to_shear( 0,th1 , 1,th2 , 2,th3 , 0,0,0,0 , 1.0,1.0,1.0 ) ;
00020 DUMP_3SHEAR("dump",shr) ;
00021 nnow = norm_3shear(shr) ;
00022 printf("Norm=%g thx=%6.1f thy=%6.1f thz=%6.1f\n",
00023 nnow, th1*(180.0/PI) , th2*(180.0/PI) , th3*(180.0/PI) );
00024 exit(0) ;
00025 }
00026
00027 ntop = 0.0 ;
00028 for( thx=1.0 ; thx < 180.0 ; thx++ ){
00029 th1 = (PI/180.0) * thx ;
00030 for( thy=1.0 ; thy < 180.0 ; thy++ ){
00031 th2 = (PI/180.0) * thy ;
00032 for( thz=1.0 ; thz < 180.0 ; thz++ ){
00033 th3 = (PI/180.0) * thz ;
00034 shr = rot_to_shear( 0,th1, 1,th2, 2,th3, 0,0,0,0, 1.0,1.0,1.0 ) ;
00035 nnow = norm_3shear( shr ) ;
00036 if( nnow > ntop ){
00037 ntop = nnow ;
00038 printf("Norm=%7.4f at thx=%6.1f thy=%6.1f thz=%6.1f\n",
00039 ntop , thx,thy,thz ) ;
00040 }
00041 }
00042 }
00043 }
00044 exit(0) ;
00045 }