VTK-m  2.2
PointTransform.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_filter_field_transform_PointTransform_h
12 #define vtk_m_filter_field_transform_PointTransform_h
13 
14 #include <vtkm/Matrix.h>
15 #include <vtkm/Transform3D.h>
16 
17 #include <vtkm/filter/Filter.h>
19 
20 namespace vtkm
21 {
22 namespace filter
23 {
24 namespace field_transform
25 {
44 {
45 public:
46  VTKM_CONT
48 
51  const vtkm::FloatDefault& ty,
52  const vtkm::FloatDefault& tz)
53  {
54  matrix = vtkm::Transform3DTranslate(tx, ty, tz);
55  }
56 
58  VTKM_CONT void SetTranslation(const vtkm::Vec3f& v) { SetTranslation(v[0], v[1], v[2]); }
59 
65  VTKM_CONT void SetRotation(const vtkm::FloatDefault& angleDegrees, const vtkm::Vec3f& axis)
66  {
67  matrix = vtkm::Transform3DRotate(angleDegrees, axis);
68  }
69 
80  VTKM_CONT void SetRotation(const vtkm::FloatDefault& angleDegrees,
81  const vtkm::FloatDefault& axisX,
82  const vtkm::FloatDefault& axisY,
83  const vtkm::FloatDefault& axisZ)
84  {
85  SetRotation(angleDegrees, { axisX, axisY, axisZ });
86  }
87 
89  VTKM_CONT void SetRotationX(const vtkm::FloatDefault& angleDegrees)
90  {
91  SetRotation(angleDegrees, 1, 0, 0);
92  }
93 
95  VTKM_CONT void SetRotationY(const vtkm::FloatDefault& angleDegrees)
96  {
97  SetRotation(angleDegrees, 0, 1, 0);
98  }
99 
101  VTKM_CONT void SetRotationZ(const vtkm::FloatDefault& angleDegrees)
102  {
103  SetRotation(angleDegrees, 0, 0, 1);
104  }
105 
109  VTKM_CONT void SetScale(const vtkm::FloatDefault& s) { matrix = vtkm::Transform3DScale(s, s, s); }
110 
113  const vtkm::FloatDefault& sy,
114  const vtkm::FloatDefault& sz)
115  {
116  matrix = vtkm::Transform3DScale(sx, sy, sz);
117  }
118 
121  {
122  matrix = vtkm::Transform3DScale(v[0], v[1], v[2]);
123  }
124 
133  VTKM_CONT
134  void SetTransform(const vtkm::Matrix<vtkm::FloatDefault, 4, 4>& mtx) { matrix = mtx; }
135 
140  void SetChangeCoordinateSystem(bool flag);
141  bool GetChangeCoordinateSystem() const;
142 
143 private:
144  VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
145 
147  bool ChangeCoordinateSystem = true;
148 };
149 } // namespace field_transform
150 } // namespace filter
151 } // namespace vtkm
152 
153 #endif // vtk_m_filter_field_transform_PointTransform_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Transform3DScale
vtkm::Matrix< T, 4, 4 > Transform3DScale(const T &scaleX, const T &scaleY, const T &scaleZ)
Returns a scale matrix.
Definition: Transform3D.h:84
vtkm::filter::field_transform::PointTransform::SetScale
void SetScale(const vtkm::FloatDefault &sx, const vtkm::FloatDefault &sy, const vtkm::FloatDefault &sz)
Scale the input field.
Definition: PointTransform.h:112
vtkm::filter::field_transform::PointTransform::SetRotationX
void SetRotationX(const vtkm::FloatDefault &angleDegrees)
Rotate the input field around the X axis by the given degrees.
Definition: PointTransform.h:89
Matrix.h
vtkm::filter::field_transform::PointTransform::SetScale
void SetScale(const vtkm::FloatDefault &s)
Scale the input field.
Definition: PointTransform.h:109
vtkm::cont::DataSet
Contains and manages the geometric data structures that VTK-m operates on.
Definition: DataSet.h:57
vtkm::filter::field_transform::PointTransform::SetScale
void SetScale(const vtkm::Vec3f &v)
Scale the input field.
Definition: PointTransform.h:120
vtkm::Transform3DRotate
vtkm::Matrix< T, 4, 4 > Transform3DRotate(T angleDegrees, const vtkm::Vec< T, 3 > &axisOfRotation)
Returns a rotation matrix.
Definition: Transform3D.h:144
vtkm_filter_field_transform_export.h
vtkm::filter::field_transform::PointTransform::SetRotationZ
void SetRotationZ(const vtkm::FloatDefault &angleDegrees)
Rotate the input field around the Z axis by the given degrees.
Definition: PointTransform.h:101
vtkm::filter::field_transform::PointTransform::SetTranslation
void SetTranslation(const vtkm::FloatDefault &tx, const vtkm::FloatDefault &ty, const vtkm::FloatDefault &tz)
Translates, or moves, each point in the input field by a given direction.
Definition: PointTransform.h:50
vtkm::filter::field_transform::PointTransform::SetTranslation
void SetTranslation(const vtkm::Vec3f &v)
Translates, or moves, each point in the input field by a given direction.
Definition: PointTransform.h:58
vtkm::filter::field_transform::PointTransform::SetRotationY
void SetRotationY(const vtkm::FloatDefault &angleDegrees)
Rotate the input field around the Y axis by the given degrees.
Definition: PointTransform.h:95
vtkm::Transform3DTranslate
vtkm::Matrix< T, 4, 4 > Transform3DTranslate(const T &x, const T &y, const T &z)
Returns a translation matrix.
Definition: Transform3D.h:121
vtkm::filter::Filter
Base class for all filters.
Definition: Filter.h:163
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::filter::field_transform::PointTransform::SetRotation
void SetRotation(const vtkm::FloatDefault &angleDegrees, const vtkm::FloatDefault &axisX, const vtkm::FloatDefault &axisY, const vtkm::FloatDefault &axisZ)
Rotate the input field about a given axis.
Definition: PointTransform.h:80
Transform3D.h
vtkm::Vec< vtkm::FloatDefault, 3 >
vtkm::filter::field_transform::PointTransform::matrix
vtkm::Matrix< vtkm::FloatDefault, 4, 4 > matrix
Definition: PointTransform.h:146
vtkm::Matrix< vtkm::FloatDefault, 4, 4 >
vtkm::FloatDefault
vtkm::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:236
vtkm::filter::field_transform::PointTransform::SetTransform
void SetTransform(const vtkm::Matrix< vtkm::FloatDefault, 4, 4 > &mtx)
Set a general transformation matrix.
Definition: PointTransform.h:134
vtkm::filter::field_transform::PointTransform::SetRotation
void SetRotation(const vtkm::FloatDefault &angleDegrees, const vtkm::Vec3f &axis)
Rotate the input field about a given axis.
Definition: PointTransform.h:65
vtkm::filter::field_transform::PointTransform
Perform affine transforms to point coordinates or vector fields.
Definition: PointTransform.h:43
VTKM_FILTER_FIELD_TRANSFORM_EXPORT
#define VTKM_FILTER_FIELD_TRANSFORM_EXPORT
Definition: vtkm_filter_field_transform_export.h:44
Filter.h