00001 // $Id: EllipticalPrism.cpp,v 1.7 2008/07/28 09:20:46 truf Exp $ 00002 // ============================================================================ 00003 // CVS tag $Name: v3r3 $ 00004 // ============================================================================ 00005 // $Log: EllipticalPrism.cpp,v $ 00006 // Revision 1.7 2008/07/28 09:20:46 truf 00007 // *** empty log message *** 00008 // 00009 // Revision 1.5 2006/03/29 08:37:15 gybarran 00010 // *** empty log message *** 00011 // 00012 // Revision 1.4 2006/03/09 16:48:15 odescham 00013 // v2r1 - migrated to LHCb v20r0 - to be completed 00014 // 00015 // Revision 1.3 2005/12/13 14:05:22 gybarran 00016 // *** empty log message *** 00017 // 00018 // Revision 1.2 2005/04/15 16:09:17 ranjard 00019 // v1r1 - adapt to CLHEP 1.9.1.2 00020 // 00021 // Revision 1.1.1.1 2004/09/08 15:52:31 ibelyaev 00022 // New package: code moved from Vis/SoCalo 00023 // 00024 // ============================================================================ 00025 // Include files 00026 // ============================================================================ 00027 // HepVis 00028 // ============================================================================ 00029 #include <Inventor/nodes/SoSphere.h> 00030 #include <HEPVis/nodes/SoEllipticalPrism.h> 00031 // ============================================================================ 00032 // local 00033 // ============================================================================ 00034 #include "SoUtils/Win32.h" 00035 #include "SoUtils/EigenSystems.h" 00036 #include "SoUtils/EllipticalPrism.h" 00037 // ============================================================================ 00038 00039 // ============================================================================ 00047 // ============================================================================ 00048 00049 // ============================================================================ 00059 // ============================================================================ 00060 StatusCode SoUtils::ellipticalprism 00061 ( const Gaudi::XYZPoint& center , 00062 const Gaudi::SymMatrix2x2& cov , 00063 const double extent , 00064 SoEllipticalPrism*& node ) 00065 { 00067 node = 0 ; 00068 00069 if( cov == 0 ) { 00071 } 00072 Gaudi::Vector3 evals ( 0 , 0 ,0 ) ; 00073 std::vector<Gaudi::Vector3> evects ; 00074 //OD StatusCode sc = SoUtils::eigensystem( cov , evals , evects ); 00075 //if( sc.isFailure () ) { return sc ; } ///< RETURN ! 00076 if( 2 != evects.size () ) { return StatusCode::FAILURE ; } 00077 // if( 2 != evals.num_row () ) { return StatusCode::FAILURE ; } ///< RETURN ! 00079 SoEllipticalPrism* ell = new SoEllipticalPrism(); 00080 ell->center. 00081 setValue( (float)center.x() , (float)center.y() , (float)center.z() ); 00082 ell->eigenvalues. 00083 setValue( (float)sqrt( evals( 1 ) ) , 00084 (float)sqrt( evals( 2 ) ) ) ; 00086 00087 Gaudi::Rotation3D rot; 00088 Gaudi::XYZVector vx ( evects[0](1) , evects[0](2) , 0 ) ; 00089 Gaudi::XYZVector vy ( evects[1](1) , evects[1](2) , 0 ) ; 00091 //OD rot.rotateAxes ( vx , vy , vx.cross( vy ) ); 00092 Gaudi::XYZVector axis ; 00093 double angle = 0; 00094 //OD rot.getAngleAxis( angle , axis ); 00095 ell->rotation.setValue 00096 (SbVec3f((float)axis.x(),(float)axis.y(),(float)axis.z()),(float)angle); 00097 ell->extent.setValue( (float)extent ); 00099 node = ell ; 00101 return StatusCode::SUCCESS ; 00102 }; 00103 00104 // ============================================================================ 00105 // The End 00106 // ============================================================================