Viskores  1.0
Warp.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_filter_field_transform_Warp_h
20 #define viskores_filter_field_transform_Warp_h
21 
22 #include <viskores/filter/Filter.h>
24 
25 namespace viskores
26 {
27 namespace filter
28 {
29 namespace field_transform
30 {
31 
61 class VISKORES_FILTER_FIELD_TRANSFORM_EXPORT Warp : public viskores::filter::Filter
62 {
63 public:
65 
69  VISKORES_CONT void SetDirectionField(const std::string& name)
70  {
71  this->UseConstantDirection = false;
72  this->SetActiveField(1, name, viskores::cont::Field::Association::Points);
73  }
75  VISKORES_CONT std::string GetDirectionFieldName() const { return this->GetActiveFieldName(1); }
76 
82  {
83  this->UseConstantDirection = true;
84  this->ConstantDirection = direction;
85  }
88  {
89  return this->ConstantDirection;
90  }
91 
96  VISKORES_CONT void SetUseConstantDirection(bool flag) { this->UseConstantDirection = flag; }
98  VISKORES_CONT bool GetUseConstantDirection() const { return this->UseConstantDirection; }
99 
104  VISKORES_CONT void SetScaleField(const std::string& name)
105  {
106  this->UseScaleField = true;
107  this->SetActiveField(2, name, viskores::cont::Field::Association::Points);
108  }
110  VISKORES_CONT std::string GetScaleFieldName() const { return this->GetActiveFieldName(2); }
111 
116  VISKORES_CONT void SetUseScaleField(bool flag) { this->UseScaleField = flag; }
118  VISKORES_CONT bool GetUseScaleField() const { return this->UseScaleField; }
119 
125  VISKORES_CONT void SetScaleFactor(viskores::FloatDefault scale) { this->ScaleFactor = scale; }
127  VISKORES_CONT viskores::FloatDefault GetScaleFactor() const { return this->ScaleFactor; }
128 
133  void SetChangeCoordinateSystem(bool flag) { this->ChangeCoordinateSystem = flag; }
135  bool GetChangeCoordinateSystem() const { return this->ChangeCoordinateSystem; }
136 
137 protected:
138  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
139 
140 private:
141  viskores::Vec3f ConstantDirection = { 0, 0, 1 };
142  viskores::FloatDefault ScaleFactor = 1;
143  bool UseConstantDirection = true;
144  bool UseScaleField = false;
145  bool ChangeCoordinateSystem = true;
146 };
147 
148 } // namespace field_transform
149 } // namespace filter
150 } // namespace viskores
151 
152 #endif // viskores_filter_field_transform_Warp_h
viskores::filter::field_transform::Warp::GetUseConstantDirection
bool GetUseConstantDirection() const
Specifies whether a direction field or a constant direction direction is used.
Definition: Warp.h:98
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::field_transform::Warp::SetScaleFactor
void SetScaleFactor(viskores::FloatDefault scale)
Specifies an additional scale factor to scale the displacements.
Definition: Warp.h:125
viskores::filter::field_transform::Warp::SetDirectionField
void SetDirectionField(const std::string &name)
Specify a field to use as the directions.
Definition: Warp.h:69
viskores::filter::field_transform::Warp::SetConstantDirection
void SetConstantDirection(const viskores::Vec3f &direction)
Specify a constant value to use as the directions.
Definition: Warp.h:81
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::filter::field_transform::Warp::SetScaleField
void SetScaleField(const std::string &name)
Specify a field to use to scale the directions.
Definition: Warp.h:104
viskores::filter::field_transform::Warp::GetUseScaleField
bool GetUseScaleField() const
Specifies whether a scale factor field is used.
Definition: Warp.h:118
viskores::filter::field_transform::Warp::SetUseScaleField
void SetUseScaleField(bool flag)
Specifies whether a scale factor field is used.
Definition: Warp.h:116
viskores::filter::field_transform::Warp::GetScaleFactor
viskores::FloatDefault GetScaleFactor() const
Specifies an additional scale factor to scale the displacements.
Definition: Warp.h:127
viskores::filter::field_transform::Warp::GetDirectionFieldName
std::string GetDirectionFieldName() const
Specify a field to use as the directions.
Definition: Warp.h:75
viskores::filter::field_transform::Warp::GetChangeCoordinateSystem
bool GetChangeCoordinateSystem() const
Specify whether the result should become the coordinate system of the output.
Definition: Warp.h:135
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::filter::field_transform::Warp::SetUseConstantDirection
void SetUseConstantDirection(bool flag)
Specifies whether a direction field or a constant direction direction is used.
Definition: Warp.h:96
viskores::filter::field_transform::Warp
Modify points by moving points along scaled direction vectors.
Definition: Warp.h:61
viskores::filter::field_transform::Warp::GetScaleFieldName
std::string GetScaleFieldName() const
Specify a field to use to scale the directions.
Definition: Warp.h:110
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::cont::Field::Association::Points
@ Points
A field that applies to points.
viskores_filter_field_transform_export.h
viskores::filter::field_transform::Warp::GetConstantDirection
const viskores::Vec3f & GetConstantDirection() const
Specify a constant value to use as the directions.
Definition: Warp.h:87
viskores::Vec< viskores::FloatDefault, 3 >
viskores::filter::field_transform::Warp::SetChangeCoordinateSystem
void SetChangeCoordinateSystem(bool flag)
Specify whether the result should become the coordinate system of the output.
Definition: Warp.h:133
Filter.h