An update will be applied January 25th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

vtkHyperOctreeFractalSource.h 4.48 KB
Newer Older
Charles Law's avatar
Charles Law committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*=========================================================================

  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.

=========================================================================*/
// .NAME vtkHyperOctreeFractalSource - Create an octree from a fractal.
// hyperoctree
// .SECTION Description
//
// .SECTION See Also
// vtkHyperOctreeSampleFunction

22
23
#ifndef vtkHyperOctreeFractalSource_h
#define vtkHyperOctreeFractalSource_h
Charles Law's avatar
Charles Law committed
24

25
#include "vtkFiltersSourcesModule.h" // For export macro
Charles Law's avatar
Charles Law committed
26
27
28
29
#include "vtkHyperOctreeAlgorithm.h"

class vtkImplicitFunction;

30
class VTKFILTERSSOURCES_EXPORT vtkHyperOctreeFractalSource : public vtkHyperOctreeAlgorithm
Charles Law's avatar
Charles Law committed
31
32
{
public:
33
  vtkTypeMacro(vtkHyperOctreeFractalSource,vtkHyperOctreeAlgorithm);
Charles Law's avatar
Charles Law committed
34
  void PrintSelf(ostream& os, vtkIndent indent);
35

Charles Law's avatar
Charles Law committed
36
37
38
39
40
41
  static vtkHyperOctreeFractalSource *New();

  // Description:
  // Return the maximum number of levels of the hyperoctree.
  // \post positive_result: result>=1
  int GetMaximumLevel();
42

Charles Law's avatar
Charles Law committed
43
44
45
46
47
48
49
  // Description:
  // 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()
  void SetMaximumLevel(int levels);
50

Charles Law's avatar
Charles Law committed
51
52
53
54
55
  // Description:
  // Return the minimal number of levels of systematic subdivision.
  // \post positive_result: result>=0
  void SetMinimumLevel(int level);
  int GetMinimumLevel();
56
57


Charles Law's avatar
Charles Law committed
58
  //========== Mandelbrot parameters ==========
59

Charles Law's avatar
Charles Law committed
60
61
  // Description:
  // Set the projection from  the 4D space (4 parameters / 2 imaginary numbers)
62
  // to the axes of the 3D Volume.
Charles Law's avatar
Charles Law committed
63
64
65
66
67
68
  // 0=C_Real, 1=C_Imaginary, 2=X_Real, 4=X_Imaginary
  void SetProjectionAxes(int x, int y, int z);
  void SetProjectionAxes(int a[3]) {this->SetProjectionAxes(a[0],a[1],a[2]);}
  vtkGetVector3Macro(ProjectionAxes, int);

  // Description:
69
  // Imaginary and real value for C (constant in equation)
Charles Law's avatar
Charles Law committed
70
71
72
73
74
  // and X (initial value).
  vtkSetVector4Macro(OriginCX, double);
  vtkGetVector4Macro(OriginCX, double);

  // Description:
75
76
  // Just a different way of setting the sample.
  // This sets the size of the 4D volume.
Charles Law's avatar
Charles Law committed
77
78
79
80
81
82
83
  // SampleCX is computed from size and extent.
  // Size is ignored when a dimension i 0 (collapsed).
  vtkSetVector4Macro(SizeCX, double);
  vtkGetVector4Macro(SizeCX, double);

  // Description:
  // The maximum number of cycles run to see if the value goes over 2
84
  vtkSetClampMacro(MaximumNumberOfIterations, unsigned short, 1, 255);
Charles Law's avatar
Charles Law committed
85
  vtkGetMacro(MaximumNumberOfIterations, unsigned char);
86

Charles Law's avatar
Charles Law committed
87
88
89
90
  // Description:
  // Create a 2D or 3D fractal.
  vtkSetClampMacro(Dimension, int, 2, 3);
  vtkGetMacro(Dimension, int);
91

Charles Law's avatar
Charles Law committed
92
  // Description:
93
  // Controls when a leaf gets subdivided.  If the corner values span
Charles Law's avatar
Charles Law committed
94
95
96
97
  // a larger range than this value, the leaf is subdivided.  This
  // defaults to 2.
  vtkSetMacro(SpanThreshold, double);
  vtkGetMacro(SpanThreshold, double);
98

Charles Law's avatar
Charles Law committed
99
100
101
protected:
  vtkHyperOctreeFractalSource();
  ~vtkHyperOctreeFractalSource();
102

Charles Law's avatar
Charles Law committed
103
104
105
  int RequestInformation (vtkInformation * vtkNotUsed(request),
                          vtkInformationVector ** vtkNotUsed( inputVector ),
                          vtkInformationVector *outputVector);
106
107

  virtual int RequestData(vtkInformation *, vtkInformationVector **,
Charles Law's avatar
Charles Law committed
108
109
110
111
112
113
                          vtkInformationVector *);

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

Charles Law's avatar
Charles Law committed
115
116
117
  int MaximumLevel;
  int MinimumLevel;
  int Dimension;
118

Charles Law's avatar
Charles Law committed
119
120
121
  int ProjectionAxes[3];

  unsigned char MaximumNumberOfIterations;
122

Charles Law's avatar
Charles Law committed
123
124
125
126
127
128
129
130
131
  // 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]);
132

Charles Law's avatar
Charles Law committed
133
134
  double Origin[3];
  double Size[3];
135

Charles Law's avatar
Charles Law committed
136
  double SpanThreshold;
137

Charles Law's avatar
Charles Law committed
138
139
140
141
142
143
private:
  vtkHyperOctreeFractalSource(const vtkHyperOctreeFractalSource&);  // Not implemented.
  void operator=(const vtkHyperOctreeFractalSource&);  // Not implemented.
};

#endif