VTK
vtkLICNoiseHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
20 #ifndef vtkLICNoiseHelper_h
21 #define vtkLICNoiseHelper_h
22 #ifndef __VTK_WRAP__
23 
24 #include "vtkRenderingLICOpenGL2Module.h" // for export
25 
27 
28 class vtkImageData;
29 
37 {
38 public:
40  {
42  }
43 
45  {
46  this->RNG->Delete();
47  }
48 
52  void SetSeed(int seedVal)
53  {
54  this->RNG->SetSeed(seedVal);
55  }
56 
60  double GetRandomNumber()
61  {
62  double val = this->RNG->GetValue();
63  this->RNG->Next();
64  return val;
65  }
66 
67 private:
68  void operator=(const vtkLICRandomNumberGeneratorInterface &) = delete;
70 
71 private:
73 };
74 
82 {
83 public:
85 
87 
104  enum {
105  UNIFORM = 0,
106  GAUSSIAN = 1,
107  PERLIN = 2
108  };
109  float *Generate(
110  int type,
111  int &sideLen,
112  int &grainLize,
113  float minNoiseVal,
114  float maxNoiseVal,
115  int nLevels,
116  double impulseProb,
117  float impulseBgNoiseVal,
118  int seed);
120 
124  void DeleteValues(unsigned char *vals){ free(vals); }
125 
126  static vtkImageData *GetNoiseResource();
127 
128 private:
132  float *GenerateUniform(
133  int sideLen,
134  int grainLize,
135  float minNoiseVal,
136  float maxNoiseVal,
137  int nLevels,
138  double impulseProb,
139  float impulseBgNoiseVal,
140  int seed);
141 
145  float *GenerateGaussian(
146  int sideLen,
147  int grainLize,
148  float minNoiseVal,
149  float maxNoiseVal,
150  int nLevels,
151  double impulseProb,
152  float impulseBgNoiseVal,
153  int seed);
154 
158  float *GeneratePerlin(
159  int sideLen,
160  int grainLize,
161  float minNoiseVal,
162  float maxNoiseVal,
163  int nLevels,
164  double impulseProb,
165  float impulseBgNoiseVal,
166  int seed);
167 
174  int ShouldGenerateValue(double prob);
175 
181  void GetValidDimensionAndGrainSize(int type, int &dim, int &grainSize);
182 
183 private:
186 };
187 
188 #endif
189 #endif
190 // VTK-HeaderTest-Exclude: vtkLICNoiseHelper.h
void Next() override
Move to the next number in the random sequence.
An interface to a random number generator.
void SetSeed(int seedVal)
Seed the random number generator.
void SetSeed(int value)
Set the seed of the random sequence.
static vtkMinimalStandardRandomSequence * New()
Standard methods for instantiation, type information, and printing.
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
double GetRandomNumber()
Get a random number in the range of 0 to 1.
Park and Miller Sequence of pseudo random numbers.
2D Noise Generator.
double GetValue() override
Current value.
virtual void Delete()
Delete a VTK object.
void DeleteValues(unsigned char *vals)
Delete the passed in array of values.