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