VTK  9.3.20240419
vtkRecursiveSphereDirectionEncoder.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
17 #ifndef vtkRecursiveSphereDirectionEncoder_h
18 #define vtkRecursiveSphereDirectionEncoder_h
19 
20 #include "vtkDirectionEncoder.h"
21 #include "vtkRenderingVolumeModule.h" // For export macro
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class VTKRENDERINGVOLUME_EXPORT vtkRecursiveSphereDirectionEncoder : public vtkDirectionEncoder
25 {
26 public:
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
36 
40  int GetEncodedDirection(float n[3]) override;
41 
45  float* GetDecodedGradient(int value) VTK_SIZEHINT(3) override;
46 
51 
58  float* GetDecodedGradientTable() override;
59 
61 
76  vtkSetClampMacro(RecursionDepth, int, 0, 6);
77  vtkGetMacro(RecursionDepth, int);
79 
80 protected:
83 
84  // How far to recursively divide the sphere
86 
87  // The index table which maps (x,y) position in the rotated grid
88  // to an encoded normal
89  // int IndexTable[2*NORM_SQR_SIZE - 1][2*NORM_SQR_SIZE -1];
90  int* IndexTable;
91 
92  // This is a table that maps encoded normal (2 byte value) to a
93  // normal (dx, dy, dz)
94  // float DecodedNormal[3*(1 + 2*(NORM_SQR_SIZE*NORM_SQR_SIZE+
95  // (NORM_SQR_SIZE-1)*(NORM_SQR_SIZE-1)))];
96  float* DecodedNormal;
97 
98  // Method to initialize the index table and variable that
99  // stored the recursion depth the last time the table was
100  // built
103 
106  int GridSize;
107 
108 private:
110  void operator=(const vtkRecursiveSphereDirectionEncoder&) = delete;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 #endif
encode a direction into a one or two byte value
a simple class to control print indentation
Definition: vtkIndent.h:108
A direction encoder based on the recursive subdivision of an octahedron.
int GetNumberOfEncodedDirections() override
Return the number of encoded directions.
int GetEncodedDirection(float n[3]) override
Given a normal vector n, return the encoded direction.
static vtkRecursiveSphereDirectionEncoder * New()
Construct the object.
void PrintSelf(ostream &os, vtkIndent indent) override
Get the name of this class.
float * GetDecodedGradientTable() override
Get the decoded gradient table.
float * GetDecodedGradient(int value) override
/ Given an encoded value, return a pointer to the normal vector
@ value
Definition: vtkX3D.h:220
#define VTK_SIZEHINT(...)