Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkRecursiveSphereDirectionEncoder.h

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