| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Ellipsoid.cpp

Go to the documentation of this file.
00001 // $Id: Ellipsoid.cpp,v 1.7 2008/07/28 08:11:22 truf Exp $
00002 // ============================================================================
00003 // CVS tag $Name: v3r3 $ 
00004 // ============================================================================
00005 // $Log: Ellipsoid.cpp,v $
00006 // Revision 1.7  2008/07/28 08:11:22  truf
00007 // just to please cmt or cvs or whatever
00008 //
00009 // Revision 1.6  2006/03/29 08:37:15  gybarran
00010 // *** empty log message ***
00011 //
00012 // Revision 1.5  2006/03/09 16:48:15  odescham
00013 // v2r1 - migrated to LHCb v20r0 - to be completed
00014 //
00015 // Revision 1.4  2005/12/13 14:05:22  gybarran
00016 // *** empty log message ***
00017 //
00018 // Revision 1.3  2005/04/15 16:09:17  ranjard
00019 // v1r1 - adapt to CLHEP 1.9.1.2
00020 //
00021 // Revision 1.2  2004/09/10 14:06:58  ibelyaev
00022 //  fix a stupid bug!
00023 //
00024 // ============================================================================
00025 // Include files
00026 // ============================================================================
00027 // HepVis 
00028 // ============================================================================
00029 #include <Inventor/nodes/SoSphere.h>
00030 #include <HEPVis/nodes/SoEllipsoid.h>
00031 // ============================================================================
00032 // local
00033 // ============================================================================
00034 #include "SoUtils/Win32.h"
00035 #include "SoUtils/EigenSystems.h"
00036 #include "SoUtils/Ellipsoid.h"
00037 // ============================================================================
00038 
00039 // ============================================================================
00047 // ============================================================================
00048 
00049 // ============================================================================
00058 // ============================================================================
00059 StatusCode SoUtils::ellipsoid
00060 ( const Gaudi::XYZPoint&   center ,  
00061   const Gaudi::SymMatrix3x3& cov    ,
00062   SoEllipsoid*&       node   )
00063 {
00065   node = 0 ;
00066   //  if( 3 != cov.num_row()    ) { return StatusCode::FAILURE ; } ///< RETURN !
00068   Gaudi::Vector3              evals  ( 0, 0 , 0 ) ;
00069   typedef std::vector<Gaudi::Vector3> Vectors ;
00070   Vectors evects           ;
00071   StatusCode  sc = SoUtils::eigensystem( cov , evals , evects );
00072   if( sc.isFailure       () ) { return sc                  ; } 
00073   if( 3 != evects.size   () ) { return StatusCode::FAILURE ; } 
00074   //  if( 3 != evals.num_row () ) { return StatusCode::FAILURE ; } ///< RETURN ! 
00076 
00077   SoEllipsoid* ell = new SoEllipsoid();
00078   ell->center.
00079     setValue( (float)center.x() , (float)center.y() , (float)center.z() );
00080   ell->eigenvalues.
00081     setValue( (float)sqrt( evals( 1 )  ) , 
00082               (float)sqrt( evals( 2 )  ) , 
00083               (float)sqrt( evals( 3 )  ) ) ;
00085   Gaudi::Rotation3D rot;
00086   Gaudi::XYZVector vx ( evects[0](1) , evects[0](2) , evects[0](3) ) ;
00087   Gaudi::XYZVector vy ( evects[1](1) , evects[1](2) , evects[1](3) ) ;
00089   //OD  rot.rotateAxes ( vx , vy , vx.Cross( vy ) );
00090 
00091   Gaudi::XYZVector axis  ;
00092   double      angle = 0;
00093   //OD  rot.getAngleAxis( angle , axis );
00094   
00095   ell->rotation.setValue
00096     (SbVec3f((float)axis.x(),(float)axis.y(),(float)axis.z()),(float)angle);
00098   node = ell ;
00100   return StatusCode::SUCCESS ;
00101 };
00102 
00103 // ============================================================================
00104 // The End 
00105 // ============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:01:49 2011 for SoUtils by doxygen 1.4.7