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
vtkMinimalStandardRandomSequence::Next
void Next() override
Move to the next number in the random sequence.
vtkMinimalStandardRandomSequence
Park and Miller Sequence of pseudo random numbers.
Definition: vtkMinimalStandardRandomSequence.h:47
vtkMinimalStandardRandomSequence::GetValue
double GetValue() override
Current value.
vtkMinimalStandardRandomSequence.h
vtkLICRandomNoise2D::PERLIN
Definition: vtkLICNoiseHelper.h:107
vtkX3D::type
Definition: vtkX3D.h:516
vtkLICRandomNumberGeneratorInterface::~vtkLICRandomNumberGeneratorInterface
~vtkLICRandomNumberGeneratorInterface()
Definition: vtkLICNoiseHelper.h:44
vtkLICRandomNumberGeneratorInterface::SetSeed
void SetSeed(int seedVal)
Seed the random number generator.
Definition: vtkLICNoiseHelper.h:52
vtkObjectBase::Delete
virtual void Delete()
Delete a VTK object.
vtkLICRandomNoise2D::UNIFORM
Definition: vtkLICNoiseHelper.h:105
vtkLICRandomNumberGeneratorInterface::GetRandomNumber
double GetRandomNumber()
Get a random number in the range of 0 to 1.
Definition: vtkLICNoiseHelper.h:60
vtkLICRandomNoise2D::GAUSSIAN
Definition: vtkLICNoiseHelper.h:106
vtkLICRandomNoise2D::DeleteValues
void DeleteValues(unsigned char *vals)
Delete the passed in array of values.
Definition: vtkLICNoiseHelper.h:124
vtkLICRandomNoise2D::vtkLICRandomNoise2D
vtkLICRandomNoise2D()
Definition: vtkLICNoiseHelper.h:84
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkMinimalStandardRandomSequence::SetSeed
void SetSeed(int value)
Set the seed of the random sequence.
vtkMinimalStandardRandomSequence::New
static vtkMinimalStandardRandomSequence * New()
Standard methods for instantiation, type information, and printing.
vtkLICRandomNoise2D::GetNoiseResource
static vtkImageData * GetNoiseResource()
vtkLICRandomNoise2D
2D Noise Generator.
Definition: vtkLICNoiseHelper.h:81
vtkLICRandomNumberGeneratorInterface
An interface to a random number generator.
Definition: vtkLICNoiseHelper.h:36
vtkLICRandomNoise2D::Generate
float * Generate(int type, int &sideLen, int &grainLize, float minNoiseVal, float maxNoiseVal, int nLevels, double impulseProb, float impulseBgNoiseVal, int seed)
vtkLICRandomNumberGeneratorInterface::vtkLICRandomNumberGeneratorInterface
vtkLICRandomNumberGeneratorInterface()
Definition: vtkLICNoiseHelper.h:39