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: 2002/01/22 23:57:48 $
00007   Version:   $Revision: 1.14 $
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   vnl_quaternion<T> GetVnlQuaternion( void ) const;
00079 
00083   void Set( const VnlQuaternionType & ); 
00084 
00088   void Set( T x, T y, T z, T w );  
00089 
00090 
00093   Versor();
00094 
00096   Versor(const Self & v);
00097 
00099   const Self& operator=(const Self & v);
00100  
00104   const Self& operator*=(const Self & v);
00105 
00110   const Self& operator/=(const Self & v);
00111 
00112 
00116   ValueType GetTensor(void) const;
00117 
00122   void Normalize(void);
00123 
00126   Self GetConjugate(void) const;
00127 
00131   Self GetReciprocal(void) const;
00132 
00135   Self operator*(const Self &vec) const;
00136 
00138   Self operator/(const Self &vec) const;
00139 
00142   bool operator==(const Self &vec) const;
00143 
00146   bool operator!=(const Self &vec) const;
00147 
00149   ValueType GetScalar( void ) const;
00150 
00152   ValueType GetX( void ) const
00153     { return m_X; }
00154 
00156   ValueType GetY( void ) const
00157     { return m_Y; }
00158 
00160   ValueType GetZ( void ) const
00161     { return m_Z; }
00162 
00164   ValueType GetW( void ) const
00165     { return m_W; }
00166 
00168   ValueType GetAngle( void ) const;
00169 
00172    VectorType GetAxis( void ) const;
00173    
00178    VectorType GetRight( void ) const;
00179    
00183   void Set( const VectorType & axis, ValueType angle );
00184   
00190   void Set( const VectorType & axis );
00191 
00198   void SetRotationAroundX( ValueType angle );
00199  
00206   void SetRotationAroundY( ValueType angle );
00207  
00214   void SetRotationAroundZ( ValueType angle );
00215 
00217   VectorType Transform( const VectorType & v ) const;
00218 
00220   CovariantVectorType Transform( const CovariantVectorType & v ) const;
00221 
00223   PointType Transform( const PointType & v ) const;
00224 
00226   VnlVectorType Transform( const VnlVectorType & v ) const;
00227 
00229   Matrix<T,3,3> GetMatrix(void) const;
00230    
00232   Self SquareRoot(void) const;
00233    
00237   Self Exponential( ValueType exponent ) const;
00238 
00239 private:
00241    ValueType  m_X;
00242    
00244    ValueType  m_Y;
00245    
00247    ValueType  m_Z;
00248 
00250    ValueType  m_W;
00251 };
00252 
00253 template< class T>  
00254 ITK_EXPORT std::ostream& operator<<( std::ostream& os, 
00255                                      const Versor<T> & v)
00256 {
00257   os << "[ ";
00258   os << v.GetX() << ", " << v.GetY() << ", ";
00259   os << v.GetZ() << ", " << v.GetW() << " ]";
00260   return os;
00261 }
00262 
00263 template< class T>
00264 ITK_EXPORT std::istream& operator>>(std::istream& is, 
00265                                     Versor<T> & v); 
00266 
00267 
00268 } // end namespace itk
00269   
00270 
00271 #ifndef ITK_MANUAL_INSTANTIATION
00272 #include "itkVersor.txx"
00273 #endif
00274 
00275 
00276 #endif 

Generated at Wed Mar 12 01:13:12 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000