VTK-m  2.0
PerlinNoise.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_source_PerlinNoise_h
12 #define vtk_m_source_PerlinNoise_h
13 
14 #include <vtkm/source/Source.h>
15 
16 namespace vtkm
17 {
18 namespace source
19 {
29 class VTKM_SOURCE_EXPORT PerlinNoise final : public vtkm::source::Source
30 {
31 public:
32  VTKM_CONT PerlinNoise() = default;
33  VTKM_CONT ~PerlinNoise() = default;
34 
35  VTKM_CONT PerlinNoise(const PerlinNoise&) = default;
36  VTKM_CONT PerlinNoise(PerlinNoise&&) = default;
37  VTKM_CONT PerlinNoise& operator=(const PerlinNoise&) = default;
38  VTKM_CONT PerlinNoise& operator=(PerlinNoise&&) = default;
39 
40  VTKM_DEPRECATED(2.0, "Use SetCellDimensions or SetPointDimensions.")
42  VTKM_DEPRECATED(2.0, "Use Set*Dimensions and SetSeed.")
44  VTKM_DEPRECATED(2.0, "Use Set*Dimensions and SetOrigin.")
46  VTKM_DEPRECATED(2.0, "Use Set*Dimensions, SetOrigin, and SetSeed.")
48 
49  VTKM_CONT vtkm::Id3 GetPointDimensions() const { return this->PointDimensions; }
50  VTKM_CONT void SetPointDimensions(vtkm::Id3 dims) { this->PointDimensions = dims; }
51 
52  VTKM_CONT vtkm::Id3 GetCellDimensions() const { return this->PointDimensions - vtkm::Id3(1); }
53  VTKM_CONT void SetCellDimensions(vtkm::Id3 dims) { this->PointDimensions = dims + vtkm::Id3(1); }
54 
55  VTKM_CONT vtkm::Vec3f GetOrigin() const { return this->Origin; }
56  VTKM_CONT void SetOrigin(const vtkm::Vec3f& origin) { this->Origin = origin; }
57 
61  VTKM_CONT vtkm::IdComponent GetSeed() const { return this->Seed; }
63  {
64  this->Seed = seed;
65  this->SeedSet = true;
66  }
67 
68 private:
69  vtkm::cont::DataSet DoExecute() const override;
70 
71  vtkm::Id3 PointDimensions = { 16, 16, 16 };
72  vtkm::Vec3f Origin = { 0, 0, 0 };
74  bool SeedSet = false;
75 };
76 } //namespace source
77 } //namespace vtkm
78 
79 #endif //vtk_m_source_PerlinNoise_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::source::PerlinNoise::SetSeed
VTKM_CONT void SetSeed(vtkm::IdComponent seed)
Definition: PerlinNoise.h:62
vtkm::source::PerlinNoise::GetPointDimensions
VTKM_CONT vtkm::Id3 GetPointDimensions() const
Definition: PerlinNoise.h:49
vtkm::source::Source
Definition: Source.h:23
vtkm::source::PerlinNoise::GetCellDimensions
VTKM_CONT vtkm::Id3 GetCellDimensions() const
Definition: PerlinNoise.h:52
vtkm::cont::DataSet
Definition: DataSet.h:34
Source.h
vtkm::source::PerlinNoise::SetPointDimensions
VTKM_CONT void SetPointDimensions(vtkm::Id3 dims)
Definition: PerlinNoise.h:50
vtkm::source::PerlinNoise::SetOrigin
VTKM_CONT void SetOrigin(const vtkm::Vec3f &origin)
Definition: PerlinNoise.h:56
vtkm::source::PerlinNoise
The PerlinNoise source creates a uniform dataset.
Definition: PerlinNoise.h:29
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id3
vtkm::Vec< vtkm::Id, 3 > Id3
Id3 corresponds to a 3-dimensional index for 3d arrays.
Definition: Types.h:1003
vtkm::source::PerlinNoise::GetSeed
VTKM_CONT vtkm::IdComponent GetSeed() const
The seed used for the pseudorandom number generation of the noise.
Definition: PerlinNoise.h:61
vtkm::source::PerlinNoise::SetCellDimensions
VTKM_CONT void SetCellDimensions(vtkm::Id3 dims)
Definition: PerlinNoise.h:53
vtkm::Vec< vtkm::Id, 3 >
vtkm::source::PerlinNoise::GetOrigin
VTKM_CONT vtkm::Vec3f GetOrigin() const
Definition: PerlinNoise.h:55
VTKM_DEPRECATED
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145