VTK  9.4.20250113
vtkLICNoiseHelper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
8#ifndef vtkLICNoiseHelper_h
9#define vtkLICNoiseHelper_h
10
11#include "vtkRenderingLICOpenGL2Module.h" // for export
12
14
15VTK_ABI_NAMESPACE_BEGIN
16class vtkImageData;
17
25{
26public:
28
30
34 void SetSeed(int seedVal) { this->RNG->SetSeed(seedVal); }
35
40 {
41 double val = this->RNG->GetValue();
42 this->RNG->Next();
43 return val;
44 }
45
46private:
47 void operator=(const vtkLICRandomNumberGeneratorInterface&) = delete;
49
51};
52
60{
61public:
63
65
82 enum
83 {
86 PERLIN = 2
87 };
88 float* Generate(int type, int& sideLen, int& grainLize, float minNoiseVal, float maxNoiseVal,
89 int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
91
95 void DeleteValues(unsigned char* vals) { free(vals); }
96
98
99private:
103 float* GenerateUniform(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
104 int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
105
109 float* GenerateGaussian(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
110 int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
111
115 float* GeneratePerlin(int sideLen, int grainLize, float minNoiseVal, float maxNoiseVal,
116 int nLevels, double impulseProb, float impulseBgNoiseVal, int seed);
117
124 int ShouldGenerateValue(double prob);
125
131 void GetValidDimensionAndGrainSize(int type, int& dim, int& grainSize);
132
135};
136
137VTK_ABI_NAMESPACE_END
138#endif
139// VTK-HeaderTest-Exclude: vtkLICNoiseHelper.h
topologically and geometrically regular array of data
2D Noise Generator.
void DeleteValues(unsigned char *vals)
Delete the passed in array of values.
vtkLICRandomNoise2D()=default
static vtkImageData * GetNoiseResource()
float * Generate(int type, int &sideLen, int &grainLize, float minNoiseVal, float maxNoiseVal, int nLevels, double impulseProb, float impulseBgNoiseVal, int seed)
Generate a patch of random gray scale values along with an alpha channel (in vtk array format).
An interface to a random number generator.
double GetRandomNumber()
Get a random number in the range of 0 to 1.
void SetSeed(int seedVal)
Seed the random number generator.
Park and Miller Sequence of pseudo random numbers.
double GetValue() override
Current value.
void Next() override
Move to the next number in the random sequence.
static vtkMinimalStandardRandomSequence * New()
Standard methods for instantiation, type information, and printing.
void SetSeed(int value)
Set the seed of the random sequence.
virtual void Delete()
Delete a VTK object.