Viskores  1.0
PointTransform.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_PointTransform_h
20 #define viskores_filter_field_transform_PointTransform_h
21 
22 #include <viskores/Matrix.h>
23 #include <viskores/Transform3D.h>
24 
25 #include <viskores/filter/Filter.h>
27 
28 namespace viskores
29 {
30 namespace filter
31 {
32 namespace field_transform
33 {
51 class VISKORES_FILTER_FIELD_TRANSFORM_EXPORT PointTransform : public viskores::filter::Filter
52 {
53 public:
56 
59  const viskores::FloatDefault& ty,
60  const viskores::FloatDefault& tz)
61  {
62  matrix = viskores::Transform3DTranslate(tx, ty, tz);
63  }
64 
66  VISKORES_CONT void SetTranslation(const viskores::Vec3f& v) { SetTranslation(v[0], v[1], v[2]); }
67 
74  const viskores::Vec3f& axis)
75  {
76  matrix = viskores::Transform3DRotate(angleDegrees, axis);
77  }
78 
90  const viskores::FloatDefault& axisX,
91  const viskores::FloatDefault& axisY,
92  const viskores::FloatDefault& axisZ)
93  {
94  SetRotation(angleDegrees, { axisX, axisY, axisZ });
95  }
96 
99  {
100  SetRotation(angleDegrees, 1, 0, 0);
101  }
102 
105  {
106  SetRotation(angleDegrees, 0, 1, 0);
107  }
108 
111  {
112  SetRotation(angleDegrees, 0, 0, 1);
113  }
114 
119  {
120  matrix = viskores::Transform3DScale(s, s, s);
121  }
122 
125  const viskores::FloatDefault& sy,
126  const viskores::FloatDefault& sz)
127  {
128  matrix = viskores::Transform3DScale(sx, sy, sz);
129  }
130 
133  {
134  matrix = viskores::Transform3DScale(v[0], v[1], v[2]);
135  }
136 
147 
152  void SetChangeCoordinateSystem(bool flag);
153  bool GetChangeCoordinateSystem() const;
154 
155 private:
156  VISKORES_CONT viskores::cont::DataSet DoExecute(const viskores::cont::DataSet& input) override;
157 
159  bool ChangeCoordinateSystem = true;
160 };
161 } // namespace field_transform
162 } // namespace filter
163 } // namespace viskores
164 
165 #endif // viskores_filter_field_transform_PointTransform_h
viskores::filter::field_transform::PointTransform
Perform affine transforms to point coordinates or vector fields.
Definition: PointTransform.h:51
viskores::filter::field_transform::PointTransform::SetScale
void SetScale(const viskores::Vec3f &v)
Scale the input field.
Definition: PointTransform.h:132
viskores::cont::DataSet
Contains and manages the geometric data structures that Viskores operates on.
Definition: DataSet.h:66
viskores::filter::field_transform::PointTransform::SetRotation
void SetRotation(const viskores::FloatDefault &angleDegrees, const viskores::Vec3f &axis)
Rotate the input field about a given axis.
Definition: PointTransform.h:73
viskores::filter::field_transform::PointTransform::SetScale
void SetScale(const viskores::FloatDefault &sx, const viskores::FloatDefault &sy, const viskores::FloatDefault &sz)
Scale the input field.
Definition: PointTransform.h:124
viskores::filter::field_transform::PointTransform::matrix
viskores::Matrix< viskores::FloatDefault, 4, 4 > matrix
Definition: PointTransform.h:158
Matrix.h
viskores::filter::Filter
Base class for all filters.
Definition: Filter.h:171
viskores::filter::field_transform::PointTransform::SetRotationX
void SetRotationX(const viskores::FloatDefault &angleDegrees)
Rotate the input field around the X axis by the given degrees.
Definition: PointTransform.h:98
viskores::filter::field_transform::PointTransform::SetTranslation
void SetTranslation(const viskores::Vec3f &v)
Translates, or moves, each point in the input field by a given direction.
Definition: PointTransform.h:66
viskores::filter::field_transform::PointTransform::SetScale
void SetScale(const viskores::FloatDefault &s)
Scale the input field.
Definition: PointTransform.h:118
viskores::Transform3DTranslate
viskores::Matrix< T, 4, 4 > Transform3DTranslate(const T &x, const T &y, const T &z)
Returns a translation matrix.
Definition: Transform3D.h:131
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::Transform3DRotate
viskores::Matrix< T, 4, 4 > Transform3DRotate(T angleDegrees, const viskores::Vec< T, 3 > &axisOfRotation)
Returns a rotation matrix.
Definition: Transform3D.h:156
viskores::Matrix< viskores::FloatDefault, 4, 4 >
viskores::filter::field_transform::PointTransform::SetRotationY
void SetRotationY(const viskores::FloatDefault &angleDegrees)
Rotate the input field around the Y axis by the given degrees.
Definition: PointTransform.h:104
Transform3D.h
viskores::filter::field_transform::PointTransform::SetRotation
void SetRotation(const viskores::FloatDefault &angleDegrees, const viskores::FloatDefault &axisX, const viskores::FloatDefault &axisY, const viskores::FloatDefault &axisZ)
Rotate the input field about a given axis.
Definition: PointTransform.h:89
viskores::filter::field_transform::PointTransform::SetTranslation
void SetTranslation(const viskores::FloatDefault &tx, const viskores::FloatDefault &ty, const viskores::FloatDefault &tz)
Translates, or moves, each point in the input field by a given direction.
Definition: PointTransform.h:58
viskores::FloatDefault
viskores::Float32 FloatDefault
The floating point type to use when no other precision is specified.
Definition: Types.h:244
viskores::filter::field_transform::PointTransform::SetTransform
void SetTransform(const viskores::Matrix< viskores::FloatDefault, 4, 4 > &mtx)
Set a general transformation matrix.
Definition: PointTransform.h:146
viskores_filter_field_transform_export.h
viskores::Vec< viskores::FloatDefault, 3 >
viskores::Transform3DScale
viskores::Matrix< T, 4, 4 > Transform3DScale(const T &scaleX, const T &scaleY, const T &scaleZ)
Returns a scale matrix.
Definition: Transform3D.h:94
viskores::filter::field_transform::PointTransform::SetRotationZ
void SetRotationZ(const viskores::FloatDefault &angleDegrees)
Rotate the input field around the Z axis by the given degrees.
Definition: PointTransform.h:110
Filter.h