vtkHyperOctreeFractalSource.h 4.57 KB
Newer Older
Charles Law's avatar
Charles Law committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkHyperOctreeFractalSource.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15
16
17
18
19
20
21
22
23
/**
 * @class   vtkHyperOctreeFractalSource
 * @brief   Create an octree from a fractal.
 * hyperoctree
 *
 *
 * @sa
 * vtkHyperOctreeSampleFunction
*/
Charles Law's avatar
Charles Law committed
24

25
26
#ifndef vtkHyperOctreeFractalSource_h
#define vtkHyperOctreeFractalSource_h
Charles Law's avatar
Charles Law committed
27

28
#include "vtkFiltersSourcesModule.h" // For export macro
Charles Law's avatar
Charles Law committed
29
30
31
32
#include "vtkHyperOctreeAlgorithm.h"

class vtkImplicitFunction;

33
#if !defined(VTK_LEGACY_REMOVE)
34
class VTKFILTERSSOURCES_EXPORT vtkHyperOctreeFractalSource : public vtkHyperOctreeAlgorithm
Charles Law's avatar
Charles Law committed
35
36
{
public:
37
  vtkTypeMacro(vtkHyperOctreeFractalSource,vtkHyperOctreeAlgorithm);
38
  void PrintSelf(ostream& os, vtkIndent indent) override;
39

Charles Law's avatar
Charles Law committed
40
41
  static vtkHyperOctreeFractalSource *New();

42
43
44
45
  /**
   * Return the maximum number of levels of the hyperoctree.
   * \post positive_result: result>=1
   */
Charles Law's avatar
Charles Law committed
46
  int GetMaximumLevel();
47

48
49
50
51
52
53
54
  /**
   * Set the maximum number of levels of the hyperoctree. If
   * GetMinLevels()>=levels, GetMinLevels() is changed to levels-1.
   * \pre positive_levels: levels>=1
   * \post is_set: this->GetLevels()==levels
   * \post min_is_valid: this->GetMinLevels()<this->GetLevels()
   */
Charles Law's avatar
Charles Law committed
55
  void SetMaximumLevel(int levels);
56

57
58
59
60
61
  //@{
  /**
   * Return the minimal number of levels of systematic subdivision.
   * \post positive_result: result>=0
   */
Charles Law's avatar
Charles Law committed
62
63
  void SetMinimumLevel(int level);
  int GetMinimumLevel();
64
  //@}
65
66


Charles Law's avatar
Charles Law committed
67
  //========== Mandelbrot parameters ==========
68

69
70
71
72
73
74
  //@{
  /**
   * Set the projection from  the 4D space (4 parameters / 2 imaginary numbers)
   * to the axes of the 3D Volume.
   * 0=C_Real, 1=C_Imaginary, 2=X_Real, 4=X_Imaginary
   */
Charles Law's avatar
Charles Law committed
75
76
77
  void SetProjectionAxes(int x, int y, int z);
  void SetProjectionAxes(int a[3]) {this->SetProjectionAxes(a[0],a[1],a[2]);}
  vtkGetVector3Macro(ProjectionAxes, int);
78
  //@}
Charles Law's avatar
Charles Law committed
79

80
81
82
83
84
  //@{
  /**
   * Imaginary and real value for C (constant in equation)
   * and X (initial value).
   */
Charles Law's avatar
Charles Law committed
85
86
  vtkSetVector4Macro(OriginCX, double);
  vtkGetVector4Macro(OriginCX, double);
87
88
89
90
91
92
93
94
95
  //@}

  //@{
  /**
   * Just a different way of setting the sample.
   * This sets the size of the 4D volume.
   * SampleCX is computed from size and extent.
   * Size is ignored when a dimension i 0 (collapsed).
   */
Charles Law's avatar
Charles Law committed
96
97
  vtkSetVector4Macro(SizeCX, double);
  vtkGetVector4Macro(SizeCX, double);
98
  //@}
Charles Law's avatar
Charles Law committed
99

100
101
102
103
  //@{
  /**
   * The maximum number of cycles run to see if the value goes over 2
   */
104
  vtkSetClampMacro(MaximumNumberOfIterations, unsigned short, 1, 255);
Charles Law's avatar
Charles Law committed
105
  vtkGetMacro(MaximumNumberOfIterations, unsigned char);
106
  //@}
107

108
109
110
111
  //@{
  /**
   * Create a 2D or 3D fractal.
   */
Charles Law's avatar
Charles Law committed
112
113
  vtkSetClampMacro(Dimension, int, 2, 3);
  vtkGetMacro(Dimension, int);
114
115
116
117
118
119
120
121
  //@}

  //@{
  /**
   * Controls when a leaf gets subdivided.  If the corner values span
   * a larger range than this value, the leaf is subdivided.  This
   * defaults to 2.
   */
Charles Law's avatar
Charles Law committed
122
123
  vtkSetMacro(SpanThreshold, double);
  vtkGetMacro(SpanThreshold, double);
124
  //@}
125

Charles Law's avatar
Charles Law committed
126
127
protected:
  vtkHyperOctreeFractalSource();
128
  ~vtkHyperOctreeFractalSource() override;
129

Charles Law's avatar
Charles Law committed
130
131
  int RequestInformation (vtkInformation * vtkNotUsed(request),
                          vtkInformationVector ** vtkNotUsed( inputVector ),
132
                          vtkInformationVector *outputVector) override;
133

134
  int RequestData(vtkInformation *, vtkInformationVector **,
135
                          vtkInformationVector *) override;
Charles Law's avatar
Charles Law committed
136
137
138
139
140

  void Subdivide(vtkHyperOctreeCursor *cursor,
                 int level, vtkHyperOctree *output,
                 double* origin, double* size,
                 float* cornerVals);
141

Charles Law's avatar
Charles Law committed
142
143
144
  int MaximumLevel;
  int MinimumLevel;
  int Dimension;
145

Charles Law's avatar
Charles Law committed
146
147
148
  int ProjectionAxes[3];

  unsigned char MaximumNumberOfIterations;
149

Charles Law's avatar
Charles Law committed
150
151
152
153
154
155
156
157
158
  // Complex constant/initial-value at origin.
  double OriginCX[4];

  // A temporary vector that is computed as needed.
  // It is used to return a vector.
  double SizeCX[4];

  float EvaluateWorldPoint(double p[3]);
  float EvaluateSet(double p[4]);
159

Charles Law's avatar
Charles Law committed
160
161
  double Origin[3];
  double Size[3];
162

Charles Law's avatar
Charles Law committed
163
  double SpanThreshold;
164

Charles Law's avatar
Charles Law committed
165
private:
166
167
  vtkHyperOctreeFractalSource(const vtkHyperOctreeFractalSource&) = delete;
  void operator=(const vtkHyperOctreeFractalSource&) = delete;
Charles Law's avatar
Charles Law committed
168
};
169
#endif //VTK_LEGACY_REMOVE
Charles Law's avatar
Charles Law committed
170
171

#endif