VTK  9.0.1
vtkRecursiveSphereDirectionEncoder.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRecursiveSphereDirectionEncoder.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
29 #ifndef vtkRecursiveSphereDirectionEncoder_h
30 #define vtkRecursiveSphereDirectionEncoder_h
31 
32 #include "vtkDirectionEncoder.h"
33 #include "vtkRenderingVolumeModule.h" // For export macro
34 
35 class VTKRENDERINGVOLUME_EXPORT vtkRecursiveSphereDirectionEncoder : public vtkDirectionEncoder
36 {
37 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
47 
51  int GetEncodedDirection(float n[3]) override;
52 
56  float* GetDecodedGradient(int value) VTK_SIZEHINT(3) override;
57 
61  int GetNumberOfEncodedDirections(void) override;
62 
69  float* GetDecodedGradientTable(void) override;
70 
72 
87  vtkSetClampMacro(RecursionDepth, int, 0, 6);
88  vtkGetMacro(RecursionDepth, int);
90 
91 protected:
94 
95  // How far to recursively divide the sphere
97 
98  // The index table which maps (x,y) position in the rotated grid
99  // to an encoded normal
100  // int IndexTable[2*NORM_SQR_SIZE - 1][2*NORM_SQR_SIZE -1];
102 
103  // This is a table that maps encoded normal (2 byte value) to a
104  // normal (dx, dy, dz)
105  // float DecodedNormal[3*(1 + 2*(NORM_SQR_SIZE*NORM_SQR_SIZE+
106  // (NORM_SQR_SIZE-1)*(NORM_SQR_SIZE-1)))];
108 
109  // Method to initialize the index table and variable that
110  // stored the recursion depth the last time the table was
111  // built
112  void InitializeIndexTable(void);
114 
117  int GridSize;
118 
119 private:
121  void operator=(const vtkRecursiveSphereDirectionEncoder&) = delete;
122 };
123 
124 #endif
encode a direction into a one or two byte value
A direction encoder based on the recursive subdivision of an octahedron.
a simple class to control print indentation
Definition: vtkIndent.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Get the name of this class.
#define VTK_SIZEHINT(...)
virtual float * GetDecodedGradient(int value)=0
/ Given an encoded value, return a pointer to the normal vector
virtual int GetEncodedDirection(float n[3])=0
Given a normal vector n, return the encoded direction.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual float * GetDecodedGradientTable(void)=0
Get the decoded gradient table.
virtual int GetNumberOfEncodedDirections(void)=0
Return the number of encoded directions.