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

itkCrossHelper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkCrossHelper.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-06 00:02:03 $
00007   Version:   $Revision: 1.3 $
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 __itkCrossHelper_h
00018 #define __itkCrossHelper_h
00019 
00020 namespace itk
00021 {
00031 template< typename TVector >
00032 class CrossHelper
00033 {
00034 public:
00035   typedef TVector                           VectorType;
00036   typedef typename VectorType::ValueType    ValueType;
00037 
00038   itkStaticConstMacro ( Dimension, unsigned int, VectorType::Dimension );
00039 
00045   VectorType operator ( ) ( const VectorType& iU,
00046                             const VectorType& iV ) const
00047     {
00048     assert ( Dimension > 2 );
00049 
00050     VectorType oCross;
00051 
00052     // *** Arnaud : InputVDimension == 3
00053     oCross[0] = iU[1] * iV[2] - iV[1] * iU[2];
00054     oCross[1] = iV[0] * iU[2] - iU[0] * iV[2];
00055     oCross[2] = iU[0] * iV[1] - iV[0] * iU[1];
00056 
00057     for( unsigned int dim = 3; dim < Dimension; dim++ )
00058       {
00059       oCross[dim] = 0.0;
00060       }
00061 
00062     return oCross;
00063     }
00064 };
00065 }
00066 
00067 #endif
00068 

Generated at Sat Feb 28 12:16:41 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000