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: 2005/02/26 21:32:45 $
00007   Version:   $Revision: 1.18 $
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 typename NumericTraits<ValueType>::RealType    RealType;
00064   
00066   typedef  Vector<T,3>   VectorType;
00067 
00069   typedef  Point<T,3>   PointType;
00070  
00072   typedef  CovariantVector<T,3>   CovariantVectorType;
00073  
00075   typedef  vnl_vector_fixed<T,3>   VnlVectorType;
00076 
00078   typedef  vnl_quaternion<T>       VnlQuaternionType;
00079 
00081   typedef  Matrix<T,3,3>          MatrixType;
00082 
00084   vnl_quaternion<T> GetVnlQuaternion( void ) const;
00085 
00089   void Set( const VnlQuaternionType & ); 
00090 
00094   void Set( T x, T y, T z, T w );  
00095 
00096 
00099   Versor();
00100 
00102   Versor(const Self & v);
00103 
00105   const Self& operator=(const Self & v);
00106  
00110   const Self& operator*=(const Self & v);
00111 
00116   const Self& operator/=(const Self & v);
00117 
00118 
00122   ValueType GetTensor(void) const;
00123 
00128   void Normalize(void);
00129 
00132   Self GetConjugate(void) const;
00133 
00137   Self GetReciprocal(void) const;
00138 
00141   Self operator*(const Self &vec) const;
00142 
00144   Self operator/(const Self &vec) const;
00145 
00148   bool operator==(const Self &vec) const;
00149 
00152   bool operator!=(const Self &vec) const;
00153 
00155   ValueType GetScalar( void ) const;
00156 
00158   ValueType GetX( void ) const
00159     { return m_X; }
00160 
00162   ValueType GetY( void ) const
00163     { return m_Y; }
00164 
00166   ValueType GetZ( void ) const
00167     { return m_Z; }
00168 
00170   ValueType GetW( void ) const
00171     { return m_W; }
00172 
00174   ValueType GetAngle( void ) const;
00175 
00178    VectorType GetAxis( void ) const;
00179    
00184    VectorType GetRight( void ) const;
00185    
00189   void Set( const VectorType & axis, ValueType angle );
00190   
00195   void Set( const MatrixType & m );
00196 
00202   void Set( const VectorType & axis );
00203 
00210   void SetRotationAroundX( ValueType angle );
00211  
00218   void SetRotationAroundY( ValueType angle );
00219  
00226   void SetRotationAroundZ( ValueType angle );
00227 
00230   void SetIdentity();
00231   
00233   VectorType Transform( const VectorType & v ) const;
00234 
00236   CovariantVectorType Transform( const CovariantVectorType & v ) const;
00237 
00239   PointType Transform( const PointType & v ) const;
00240 
00242   VnlVectorType Transform( const VnlVectorType & v ) const;
00243 
00245   MatrixType GetMatrix(void) const;
00246    
00248   Self SquareRoot(void) const;
00249    
00253   Self Exponential( ValueType exponent ) const;
00254 
00255 private:
00257    ValueType  m_X;
00258    
00260    ValueType  m_Y;
00261    
00263    ValueType  m_Z;
00264 
00266    ValueType  m_W;
00267 };
00268 
00269 template< class T>  
00270 ITK_EXPORT std::ostream& operator<<( std::ostream& os, 
00271                                      const Versor<T> & v)
00272 {
00273   os << "[ ";
00274   os << v.GetX() << ", " << v.GetY() << ", ";
00275   os << v.GetZ() << ", " << v.GetW() << " ]";
00276   return os;
00277 }
00278 
00279 template< class T>
00280 ITK_EXPORT std::istream& operator>>(std::istream& is, 
00281                                     Versor<T> & v); 
00282 
00283 
00284 } // end namespace itk
00285   
00286 
00287 #ifndef ITK_MANUAL_INSTANTIATION
00288 #include "itkVersor.txx"
00289 #endif
00290 
00291 
00292 #endif 

Generated at Thu May 25 00:14:58 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000