Viskores  1.0
PerlinNoise.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_source_PerlinNoise_h
20 #define viskores_source_PerlinNoise_h
21 
22 #include <viskores/source/Source.h>
23 
24 namespace viskores
25 {
26 namespace source
27 {
37 class VISKORES_SOURCE_EXPORT PerlinNoise final : public viskores::source::Source
38 {
39 public:
40  VISKORES_CONT PerlinNoise() = default;
41  VISKORES_CONT ~PerlinNoise() = default;
42 
43  VISKORES_CONT PerlinNoise(const PerlinNoise&) = default;
45  VISKORES_CONT PerlinNoise& operator=(const PerlinNoise&) = default;
46  VISKORES_CONT PerlinNoise& operator=(PerlinNoise&&) = default;
47 
48  VISKORES_DEPRECATED(2.0, "Use SetCellDimensions or SetPointDimensions.")
50  VISKORES_DEPRECATED(2.0, "Use Set*Dimensions and SetSeed.")
52  VISKORES_DEPRECATED(2.0, "Use Set*Dimensions and SetOrigin.")
54  VISKORES_DEPRECATED(2.0, "Use Set*Dimensions, SetOrigin, and SetSeed.")
56 
57  VISKORES_CONT viskores::Id3 GetPointDimensions() const { return this->PointDimensions; }
58  VISKORES_CONT void SetPointDimensions(viskores::Id3 dims) { this->PointDimensions = dims; }
59 
61  {
62  return this->PointDimensions - viskores::Id3(1);
63  }
65  {
66  this->PointDimensions = dims + viskores::Id3(1);
67  }
68 
69  VISKORES_CONT viskores::Vec3f GetOrigin() const { return this->Origin; }
70  VISKORES_CONT void SetOrigin(const viskores::Vec3f& origin) { this->Origin = origin; }
71 
75  VISKORES_CONT viskores::IdComponent GetSeed() const { return this->Seed; }
77  {
78  this->Seed = seed;
79  this->SeedSet = true;
80  }
81 
82 private:
83  viskores::cont::DataSet DoExecute() const override;
84 
85  viskores::Id3 PointDimensions = { 16, 16, 16 };
86  viskores::Vec3f Origin = { 0, 0, 0 };
88  bool SeedSet = false;
89 };
90 } //namespace source
91 } //namespace viskores
92 
93 #endif //viskores_source_PerlinNoise_h
viskores::source::PerlinNoise::SetPointDimensions
void SetPointDimensions(viskores::Id3 dims)
Definition: PerlinNoise.h:58
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
Source.h
viskores::source::PerlinNoise::GetCellDimensions
viskores::Id3 GetCellDimensions() const
Definition: PerlinNoise.h:60
viskores::source::Source
Definition: Source.h:31
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::Id3
viskores::Vec< viskores::Id, 3 > Id3
Id3 corresponds to a 3-dimensional index for 3d arrays.
Definition: Types.h:1053
viskores::source::PerlinNoise::GetSeed
viskores::IdComponent GetSeed() const
The seed used for the pseudorandom number generation of the noise.
Definition: PerlinNoise.h:75
viskores::source::PerlinNoise::SetSeed
void SetSeed(viskores::IdComponent seed)
Definition: PerlinNoise.h:76
viskores::source::PerlinNoise::SetOrigin
void SetOrigin(const viskores::Vec3f &origin)
Definition: PerlinNoise.h:70
viskores::source::PerlinNoise::GetPointDimensions
viskores::Id3 GetPointDimensions() const
Definition: PerlinNoise.h:57
viskores::source::PerlinNoise::SetCellDimensions
void SetCellDimensions(viskores::Id3 dims)
Definition: PerlinNoise.h:64
viskores::Vec< viskores::Id, 3 >
viskores::source::PerlinNoise::GetOrigin
viskores::Vec3f GetOrigin() const
Definition: PerlinNoise.h:69
viskores::source::PerlinNoise
The PerlinNoise source creates a uniform dataset.
Definition: PerlinNoise.h:37