00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkRecursiveSphereDirectionEncoder.h 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 00028 #ifndef __vtkRecursiveSphereDirectionEncoder_h 00029 #define __vtkRecursiveSphereDirectionEncoder_h 00030 00031 #include "vtkDirectionEncoder.h" 00032 00033 class VTK_VOLUMERENDERING_EXPORT vtkRecursiveSphereDirectionEncoder : public vtkDirectionEncoder 00034 { 00035 public: 00036 vtkTypeMacro(vtkRecursiveSphereDirectionEncoder,vtkDirectionEncoder); 00037 void PrintSelf( ostream& os, vtkIndent indent ); 00038 00041 static vtkRecursiveSphereDirectionEncoder *New(); 00042 00043 00045 int GetEncodedDirection( float n[3] ); 00046 00048 float *GetDecodedGradient( int value ); 00049 00051 int GetNumberOfEncodedDirections( void ); 00052 00057 float *GetDecodedGradientTable( void ); 00058 00060 00072 vtkSetClampMacro( RecursionDepth, int, 0, 6 ); 00073 vtkGetMacro( RecursionDepth, int ); 00075 00076 protected: 00077 vtkRecursiveSphereDirectionEncoder(); 00078 ~vtkRecursiveSphereDirectionEncoder(); 00079 00080 // How far to recursively divide the sphere 00081 int RecursionDepth; 00082 00083 // The index table which maps (x,y) position in the rotated grid 00084 // to an encoded normal 00085 //int IndexTable[2*NORM_SQR_SIZE - 1][2*NORM_SQR_SIZE -1]; 00086 int *IndexTable; 00087 00088 // This is a table that maps encoded normal (2 byte value) to a 00089 // normal (dx, dy, dz) 00090 //float DecodedNormal[3*(1 + 2*(NORM_SQR_SIZE*NORM_SQR_SIZE+ 00091 // (NORM_SQR_SIZE-1)*(NORM_SQR_SIZE-1)))]; 00092 float *DecodedNormal; 00093 00094 // Method to initialize the index table and variable that 00095 // stored the recursion depth the last time the table was 00096 // built 00097 void InitializeIndexTable( void ); 00098 int IndexTableRecursionDepth; 00099 00100 int OuterSize; 00101 int InnerSize; 00102 int GridSize; 00103 private: 00104 vtkRecursiveSphereDirectionEncoder(const vtkRecursiveSphereDirectionEncoder&); // Not implemented. 00105 void operator=(const vtkRecursiveSphereDirectionEncoder&); // Not implemented. 00106 }; 00107 00108 00109 #endif 00110