VTK  9.7.1
vtkLinearTransform.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkLinearTransform_h
25 #define vtkLinearTransform_h
26 
27 #include "vtkCommonTransformsModule.h" // For export macro
29 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class VTKCOMMONTRANSFORMS_EXPORT VTK_MARSHALAUTO vtkLinearTransform : public vtkHomogeneousTransform
33 {
34 public:
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
42  void TransformNormal(const float in[3], float out[3])
43  {
44  this->Update();
45  this->InternalTransformNormal(in, out);
46  }
47 
52  void TransformNormal(const double in[3], double out[3])
53  {
54  this->Update();
55  this->InternalTransformNormal(in, out);
56  }
57 
62  double* TransformNormal(double x, double y, double z) VTK_SIZEHINT(3)
63  {
64  return this->TransformDoubleNormal(x, y, z);
65  }
66  double* TransformNormal(const double normal[3]) VTK_SIZEHINT(3)
67  {
68  return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
69  }
70 
72 
76  float* TransformFloatNormal(float x, float y, float z) VTK_SIZEHINT(3)
77  {
78  this->InternalFloatPoint[0] = x;
79  this->InternalFloatPoint[1] = y;
80  this->InternalFloatPoint[2] = z;
81  this->TransformNormal(this->InternalFloatPoint, this->InternalFloatPoint);
82  return this->InternalFloatPoint;
83  }
84  float* TransformFloatNormal(const float normal[3]) VTK_SIZEHINT(3)
85  {
86  return this->TransformFloatNormal(normal[0], normal[1], normal[2]);
87  }
89 
91 
95  double* TransformDoubleNormal(double x, double y, double z) VTK_SIZEHINT(3)
96  {
97  this->InternalDoublePoint[0] = x;
98  this->InternalDoublePoint[1] = y;
99  this->InternalDoublePoint[2] = z;
100  this->TransformNormal(this->InternalDoublePoint, this->InternalDoublePoint);
101  return this->InternalDoublePoint;
102  }
103  double* TransformDoubleNormal(const double normal[3]) VTK_SIZEHINT(3)
104  {
105  return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
106  }
108 
113  double* TransformVector(double x, double y, double z) VTK_SIZEHINT(3)
114  {
115  return this->TransformDoubleVector(x, y, z);
116  }
117  double* TransformVector(const double normal[3]) VTK_SIZEHINT(3)
118  {
119  return this->TransformDoubleVector(normal[0], normal[1], normal[2]);
120  }
121 
126  void TransformVector(const float in[3], float out[3])
127  {
128  this->Update();
129  this->InternalTransformVector(in, out);
130  }
131 
136  void TransformVector(const double in[3], double out[3])
137  {
138  this->Update();
139  this->InternalTransformVector(in, out);
140  }
141 
143 
147  float* TransformFloatVector(float x, float y, float z) VTK_SIZEHINT(3)
148  {
149  this->InternalFloatPoint[0] = x;
150  this->InternalFloatPoint[1] = y;
151  this->InternalFloatPoint[2] = z;
152  this->TransformVector(this->InternalFloatPoint, this->InternalFloatPoint);
153  return this->InternalFloatPoint;
154  }
155  float* TransformFloatVector(const float vec[3]) VTK_SIZEHINT(3)
156  {
157  return this->TransformFloatVector(vec[0], vec[1], vec[2]);
158  }
160 
162 
166  double* TransformDoubleVector(double x, double y, double z) VTK_SIZEHINT(3)
167  {
168  this->InternalDoublePoint[0] = x;
169  this->InternalDoublePoint[1] = y;
170  this->InternalDoublePoint[2] = z;
171  this->TransformVector(this->InternalDoublePoint, this->InternalDoublePoint);
172  return this->InternalDoublePoint;
173  }
174  double* TransformDoubleVector(const double vec[3]) VTK_SIZEHINT(3)
175  {
176  return this->TransformDoubleVector(vec[0], vec[1], vec[2]);
177  }
179 
184  void TransformPoints(vtkPoints* inPts, vtkPoints* outPts) override;
185 
192  void TransformNormals(vtkDataArray* inNms, vtkDataArray* outNms) override;
193 
198  void TransformVectors(vtkDataArray* inVrs, vtkDataArray* outVrs) override;
199 
204  void TransformPointsNormalsVectors(vtkPoints* inPts, vtkPoints* outPts, vtkDataArray* inNms,
205  vtkDataArray* outNms, vtkDataArray* inVrs, vtkDataArray* outVrs, int nOptionalVectors = 0,
206  vtkDataArray** inVrsArr = nullptr, vtkDataArray** outVrsArr = nullptr) override;
207 
213  {
214  return static_cast<vtkLinearTransform*>(this->GetInverse());
215  }
216 
218 
222  void InternalTransformPoint(const float in[3], float out[3]) override;
223  void InternalTransformPoint(const double in[3], double out[3]) override;
225 
227 
231  virtual void InternalTransformNormal(const float in[3], float out[3]);
232  virtual void InternalTransformNormal(const double in[3], double out[3]);
234 
236 
240  virtual void InternalTransformVector(const float in[3], float out[3]);
241  virtual void InternalTransformVector(const double in[3], double out[3]);
243 
245 
251  const float in[3], float out[3], float derivative[3][3]) override;
253  const double in[3], double out[3], double derivative[3][3]) override;
255 
256 protected:
257  vtkLinearTransform() = default;
258  ~vtkLinearTransform() override = default;
259 
260 private:
261  vtkLinearTransform(const vtkLinearTransform&) = delete;
262  void operator=(const vtkLinearTransform&) = delete;
263 };
264 
265 VTK_ABI_NAMESPACE_END
266 #endif
void TransformNormal(const double in[3], double out[3])
Apply the transformation to a double-precision normal.
double * TransformDoubleNormal(double x, double y, double z)
Apply the transformation to a double-precision (x,y,z) normal.
void TransformVector(const float in[3], float out[3])
Apply the transformation to a vector.
virtual void TransformVectors(vtkDataArray *inArray, vtkDataArray *outArray)
Apply the transformation to the 3-components array.
float * TransformFloatNormal(float x, float y, float z)
Apply the transformation to an (x,y,z) normal.
superclass for homogeneous transformations
void InternalTransformPoint(const float in[3], float out[3]) override
This will calculate the transformation without calling Update.
double * TransformDoubleNormal(const double normal[3])
Apply the transformation to a double-precision (x,y,z) normal.
float * TransformFloatNormal(const float normal[3])
Apply the transformation to an (x,y,z) normal.
vtkAbstractTransform * GetInverse()
Get the inverse of this transform.
virtual void TransformNormals(vtkDataArray *inArray, vtkDataArray *outArray)
Apply the transformation to the normals.
double * TransformVector(double x, double y, double z)
Synonymous with TransformDoubleVector(x,y,z).
void TransformVector(const double in[3], double out[3])
Apply the transformation to a double-precision vector.
double * TransformVector(const double normal[3])
vtkLinearTransform * GetLinearInverse()
Just like GetInverse, but it includes a typecast to vtkLinearTransform.
float * TransformFloatVector(const float vec[3])
Apply the transformation to an (x,y,z) vector.
void Update()
Update the transform to account for any changes which have been made.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
double * TransformNormal(const double normal[3])
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
#define VTK_SIZEHINT(...)
double * TransformNormal(double x, double y, double z)
Synonymous with TransformDoubleNormal(x,y,z).
void TransformNormal(const float in[3], float out[3])
Apply the transformation to a normal.
void TransformPoints(vtkPoints *inPts, vtkPoints *outPts) override
Apply the transformation to a series of points, and append the results to outPts. ...
void InternalTransformDerivative(const float in[3], float out[3], float derivative[3][3]) override
This will calculate the transformation as well as its derivative without calling Update.
float * TransformFloatVector(float x, float y, float z)
Apply the transformation to an (x,y,z) vector.
double * TransformDoubleVector(const double vec[3])
Apply the transformation to a double-precision (x,y,z) vector.
#define VTK_MARSHALAUTO
void TransformPointsNormalsVectors(vtkPoints *inPts, vtkPoints *outPts, vtkDataArray *inNms, vtkDataArray *outNms, vtkDataArray *inVrs, vtkDataArray *outVrs, int nOptionalVectors=0, vtkDataArray **inVrsArr=nullptr, vtkDataArray **outVrsArr=nullptr) override
Apply the transformation to a combination of points, normals and vectors.
double * TransformDoubleVector(double x, double y, double z)
Apply the transformation to a double-precision (x,y,z) vector.
represent and manipulate 3D points
Definition: vtkPoints.h:30
abstract superclass for linear transformations