Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkRecursiveSphereDirectionEncoder.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkRecursiveSphereDirectionEncoder.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00016 
00043 #ifndef __vtkRecursiveSphereDirectionEncoder_h
00044 #define __vtkRecursiveSphereDirectionEncoder_h
00045 
00046 #include "vtkDirectionEncoder.h"
00047 
00048 class VTK_RENDERING_EXPORT vtkRecursiveSphereDirectionEncoder : public vtkDirectionEncoder
00049 {
00050 public:
00051   vtkTypeRevisionMacro(vtkRecursiveSphereDirectionEncoder,vtkDirectionEncoder);
00052   void PrintSelf( ostream& os, vtkIndent indent );
00053 
00056   static vtkRecursiveSphereDirectionEncoder *New();
00057 
00058 
00060   int GetEncodedDirection( float n[3] );
00061   
00063   float *GetDecodedGradient( int value );
00064 
00066   int GetNumberOfEncodedDirections( void );
00067 
00072   float *GetDecodedGradientTable( void );
00073 
00075 
00087   vtkSetClampMacro( RecursionDepth, int, 0, 6 );
00088   vtkGetMacro( RecursionDepth, int );                                        
00090 
00091 protected:
00092   vtkRecursiveSphereDirectionEncoder();
00093   ~vtkRecursiveSphereDirectionEncoder();
00094 
00095   // How far to recursively divide the sphere
00096   int                     RecursionDepth;
00097   
00098   // The index table which maps (x,y) position in the rotated grid
00099   // to an encoded normal 
00100   //int                   IndexTable[2*NORM_SQR_SIZE - 1][2*NORM_SQR_SIZE -1];
00101   int                     *IndexTable;
00102 
00103   // This is a table that maps encoded normal (2 byte value) to a 
00104   // normal (dx, dy, dz)
00105   //float                 DecodedNormal[3*(1 + 2*(NORM_SQR_SIZE*NORM_SQR_SIZE+
00106   //                             (NORM_SQR_SIZE-1)*(NORM_SQR_SIZE-1)))];
00107   float                   *DecodedNormal;
00108 
00109   // Method to initialize the index table and variable that
00110   // stored the recursion depth the last time the table was
00111   // built
00112   void                  InitializeIndexTable( void );
00113   int                   IndexTableRecursionDepth;
00114 
00115   int                   OuterSize;
00116   int                   InnerSize;
00117   int                   GridSize;
00118 private:
00119   vtkRecursiveSphereDirectionEncoder(const vtkRecursiveSphereDirectionEncoder&);  // Not implemented.
00120   void operator=(const vtkRecursiveSphereDirectionEncoder&);  // Not implemented.
00121 }; 
00122 
00123 
00124 #endif
00125