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: 2003/01/14 14:47:59 $
00007   Version:   $Revision: 1.15 $
00008 
00009   Copyright (c) 2002 Insight 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   
00193   void Set( const VectorType & axis );
00194 
00201   void SetRotationAroundX( ValueType angle );
00202  
00209   void SetRotationAroundY( ValueType angle );
00210  
00217   void SetRotationAroundZ( ValueType angle );
00218 
00221   void SetIdentity();
00222   
00224   VectorType Transform( const VectorType & v ) const;
00225 
00227   CovariantVectorType Transform( const CovariantVectorType & v ) const;
00228 
00230   PointType Transform( const PointType & v ) const;
00231 
00233   VnlVectorType Transform( const VnlVectorType & v ) const;
00234 
00236   MatrixType GetMatrix(void) const;
00237    
00239   Self SquareRoot(void) const;
00240    
00244   Self Exponential( ValueType exponent ) const;
00245 
00246 private:
00248    ValueType  m_X;
00249    
00251    ValueType  m_Y;
00252    
00254    ValueType  m_Z;
00255 
00257    ValueType  m_W;
00258 };
00259 
00260 template< class T>  
00261 ITK_EXPORT std::ostream& operator<<( std::ostream& os, 
00262                                      const Versor<T> & v)
00263 {
00264   os << "[ ";
00265   os << v.GetX() << ", " << v.GetY() << ", ";
00266   os << v.GetZ() << ", " << v.GetW() << " ]";
00267   return os;
00268 }
00269 
00270 template< class T>
00271 ITK_EXPORT std::istream& operator>>(std::istream& is, 
00272                                     Versor<T> & v); 
00273 
00274 
00275 } // end namespace itk
00276   
00277 
00278 #ifndef ITK_MANUAL_INSTANTIATION
00279 #include "itkVersor.txx"
00280 #endif
00281 
00282 
00283 #endif 

Generated at Fri May 21 01:15:32 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000