Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkVersor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVersor.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/08/19 19:32:37 $
00007   Version:   $Revision: 1.17 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkVersor_h
00018 #define __itkVersor_h
00019 
00020 #include "itkVector.h"
00021 #include "itkPoint.h"
00022 #include "itkMatrix.h"
00023 #include "itkCovariantVector.h"
00024 #include "vnl/vnl_quaternion.h"
00025 #include "vnl/vnl_vector_fixed.h"
00026 
00027 namespace itk
00028 {
00029 
00051 template<class T> 
00052 class Versor 
00053 {
00054 public:
00056   typedef Versor  Self;
00057    
00060   typedef T ValueType;
00061 
00063   typedef  Vector<T,3>   VectorType;
00064 
00066   typedef  Point<T,3>   PointType;
00067  
00069   typedef  CovariantVector<T,3>   CovariantVectorType;
00070  
00072   typedef  vnl_vector_fixed<T,3>   VnlVectorType;
00073 
00075   typedef  vnl_quaternion<T>       VnlQuaternionType;
00076 
00078   typedef  Matrix<T,3,3>          MatrixType;
00079 
00081   vnl_quaternion<T> GetVnlQuaternion( void ) const;
00082 
00086   void Set( const VnlQuaternionType & ); 
00087 
00091   void Set( T x, T y, T z, T w );  
00092 
00093 
00096   Versor();
00097 
00099   Versor(const Self & v);
00100 
00102   const Self& operator=(const Self & v);
00103  
00107   const Self& operator*=(const Self & v);
00108 
00113   const Self& operator/=(const Self & v);
00114 
00115 
00119   ValueType GetTensor(void) const;
00120 
00125   void Normalize(void);
00126 
00129   Self GetConjugate(void) const;
00130 
00134   Self GetReciprocal(void) const;
00135 
00138   Self operator*(const Self &vec) const;
00139 
00141   Self operator/(const Self &vec) const;
00142 
00145   bool operator==(const Self &vec) const;
00146 
00149   bool operator!=(const Self &vec) const;
00150 
00152   ValueType GetScalar( void ) const;
00153 
00155   ValueType GetX( void ) const
00156     { return m_X; }
00157 
00159   ValueType GetY( void ) const
00160     { return m_Y; }
00161 
00163   ValueType GetZ( void ) const
00164     { return m_Z; }
00165 
00167   ValueType GetW( void ) const
00168     { return m_W; }
00169 
00171   ValueType GetAngle( void ) const;
00172 
00175    VectorType GetAxis( void ) const;
00176    
00181    VectorType GetRight( void ) const;
00182    
00186   void Set( const VectorType & axis, ValueType angle );
00187   
00192   void Set( const MatrixType & m );
00193 
00199   void Set( const VectorType & axis );
00200 
00207   void SetRotationAroundX( ValueType angle );
00208  
00215   void SetRotationAroundY( ValueType angle );
00216  
00223   void SetRotationAroundZ( ValueType angle );
00224 
00227   void SetIdentity();
00228   
00230   VectorType Transform( const VectorType & v ) const;
00231 
00233   CovariantVectorType Transform( const CovariantVectorType & v ) const;
00234 
00236   PointType Transform( const PointType & v ) const;
00237 
00239   VnlVectorType Transform( const VnlVectorType & v ) const;
00240 
00242   MatrixType GetMatrix(void) const;
00243    
00245   Self SquareRoot(void) const;
00246    
00250   Self Exponential( ValueType exponent ) const;
00251 
00252 private:
00254    ValueType  m_X;
00255    
00257    ValueType  m_Y;
00258    
00260    ValueType  m_Z;
00261 
00263    ValueType  m_W;
00264 };
00265 
00266 template< class T>  
00267 ITK_EXPORT std::ostream& operator<<( std::ostream& os, 
00268                                      const Versor<T> & v)
00269 {
00270   os << "[ ";
00271   os << v.GetX() << ", " << v.GetY() << ", ";
00272   os << v.GetZ() << ", " << v.GetW() << " ]";
00273   return os;
00274 }
00275 
00276 template< class T>
00277 ITK_EXPORT std::istream& operator>>(std::istream& is, 
00278                                     Versor<T> & v); 
00279 
00280 
00281 } // end namespace itk
00282   
00283 
00284 #ifndef ITK_MANUAL_INSTANTIATION
00285 #include "itkVersor.txx"
00286 #endif
00287 
00288 
00289 #endif 

Generated at Wed Mar 30 00:15:06 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000