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
23#include "vtkRenderingLICOpenGL2Module.h" // for export
24
26
27class vtkImageData;
28
36{
37public:
39 {
41 }
42
44 {
45 this->RNG->Delete();
46 }
47
51 void SetSeed(int seedVal)
52 {
53 this->RNG->SetSeed(seedVal);
54 }
55
60 {
61 double val = this->RNG->GetValue();
62 this->RNG->Next();
63 return val;
64 }
65
66private:
67 void operator=(const vtkLICRandomNumberGeneratorInterface &) VTK_DELETE_FUNCTION;
69
70private:
72};
73
81{
82public:
84
86
103 enum {
106 PERLIN = 2
107 };
108 float *Generate(
109 int type,
110 int &sideLen,
111 int &grainLize,
112 float minNoiseVal,
113 float maxNoiseVal,
114 int nLevels,
115 double impulseProb,
116 float impulseBgNoiseVal,
117 int seed);
119
123 void DeleteValues(unsigned char *vals){ free(vals); }
124
126
127private:
131 float *GenerateUniform(
132 int sideLen,
133 int grainLize,
134 float minNoiseVal,
135 float maxNoiseVal,
136 int nLevels,
137 double impulseProb,
138 float impulseBgNoiseVal,
139 int seed);
140
144 float *GenerateGaussian(
145 int sideLen,
146 int grainLize,
147 float minNoiseVal,
148 float maxNoiseVal,
149 int nLevels,
150 double impulseProb,
151 float impulseBgNoiseVal,
152 int seed);
153
157 float *GeneratePerlin(
158 int sideLen,
159 int grainLize,
160 float minNoiseVal,
161 float maxNoiseVal,
162 int nLevels,
163 double impulseProb,
164 float impulseBgNoiseVal,
165 int seed);
166
173 int ShouldGenerateValue(double prob);
174
180 void GetValidDimensionAndGrainSize(int type, int &dim, int &grainSize);
181
182private:
185};
186
187#endif
188// VTK-HeaderTest-Exclude: vtkLICNoiseHelper.h
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
2D Noise Generator.
void DeleteValues(unsigned char *vals)
Delete the passed in array of values.
static vtkImageData * GetNoiseResource()
float * Generate(int type, int &sideLen, int &grainLize, float minNoiseVal, float maxNoiseVal, int nLevels, double impulseProb, float impulseBgNoiseVal, int seed)
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()
void SetSeed(int value)
Set the seed of the random sequence.
virtual void Delete()
Delete a VTK object.
@ type
Definition: vtkX3D.h:516