VTK  9.0.20200704
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 =========================================================================*/
19 #ifndef vtkLICNoiseHelper_h
20 #define vtkLICNoiseHelper_h
21 #ifndef __VTK_WRAP__
22 
23 #include "vtkRenderingLICOpenGL2Module.h" // for export
24 
26 
27 class vtkImageData;
28 
36 {
37 public:
39 
41 
45  void SetSeed(int seedVal) { this->RNG->SetSeed(seedVal); }
46 
50  double GetRandomNumber()
51  {
52  double val = this->RNG->GetValue();
53  this->RNG->Next();
54  return val;
55  }
56 
57 private:
58  void operator=(const vtkLICRandomNumberGeneratorInterface&) = delete;
60 
61 private:
63 };
64 
72 {
73 public:
74  vtkLICRandomNoise2D() = default;
75 
77 
94  enum
95  {
96  UNIFORM = 0,
97  GAUSSIAN = 1,
98  PERLIN = 2
99  };
100  float* Generate(int type, int& sideLen, int& grainLize, float minNoiseVal, float maxNoiseVal,
101  int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
103 
107  void DeleteValues(unsigned char* vals) { free(vals); }
108 
109  static vtkImageData* GetNoiseResource();
110 
111 private:
115  float* GenerateUniform(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
116  int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
117 
121  float* GenerateGaussian(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
122  int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
123 
127  float* GeneratePerlin(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
128  int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
129 
136  int ShouldGenerateValue(double prob);
137 
143  void GetValidDimensionAndGrainSize(int type, int& dim, int& grainSize);
144 
145 private:
148 };
149 
150 #endif
151 #endif
152 // 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:41
vtkMinimalStandardRandomSequence::GetValue
double GetValue() override
Current value.
vtkMinimalStandardRandomSequence.h
vtkLICRandomNoise2D::UNIFORM
Definition: vtkLICNoiseHelper.h:96
vtkX3D::type
Definition: vtkX3D.h:522
vtkLICRandomNumberGeneratorInterface::~vtkLICRandomNumberGeneratorInterface
~vtkLICRandomNumberGeneratorInterface()
Definition: vtkLICNoiseHelper.h:40
vtkLICRandomNumberGeneratorInterface::SetSeed
void SetSeed(int seedVal)
Seed the random number generator.
Definition: vtkLICNoiseHelper.h:45
vtkLICRandomNoise2D::vtkLICRandomNoise2D
vtkLICRandomNoise2D()=default
vtkObjectBase::Delete
virtual void Delete()
Delete a VTK object.
vtkLICRandomNoise2D::PERLIN
Definition: vtkLICNoiseHelper.h:98
vtkLICRandomNumberGeneratorInterface::GetRandomNumber
double GetRandomNumber()
Get a random number in the range of 0 to 1.
Definition: vtkLICNoiseHelper.h:50
vtkLICRandomNoise2D::DeleteValues
void DeleteValues(unsigned char *vals)
Delete the passed in array of values.
Definition: vtkLICNoiseHelper.h:107
vtkLICRandomNoise2D::GAUSSIAN
Definition: vtkLICNoiseHelper.h:97
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
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:71
vtkLICRandomNumberGeneratorInterface
An interface to a random number generator.
Definition: vtkLICNoiseHelper.h:35
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:38