VTK  9.2.6
vtkLinearTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLinearTransform.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
65 #ifndef vtkLinearTransform_h
66 #define vtkLinearTransform_h
67 
68 #include "vtkCommonTransformsModule.h" // For export macro
70 
71 class VTKCOMMONTRANSFORMS_EXPORT vtkLinearTransform : public vtkHomogeneousTransform
72 {
73 public:
75  void PrintSelf(ostream& os, vtkIndent indent) override;
76 
81  void TransformNormal(const float in[3], float out[3])
82  {
83  this->Update();
84  this->InternalTransformNormal(in, out);
85  }
86 
91  void TransformNormal(const double in[3], double out[3])
92  {
93  this->Update();
94  this->InternalTransformNormal(in, out);
95  }
96 
101  double* TransformNormal(double x, double y, double z) VTK_SIZEHINT(3)
102  {
103  return this->TransformDoubleNormal(x, y, z);
104  }
105  double* TransformNormal(const double normal[3]) VTK_SIZEHINT(3)
106  {
107  return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
108  }
109 
111 
115  float* TransformFloatNormal(float x, float y, float z) VTK_SIZEHINT(3)
116  {
117  this->InternalFloatPoint[0] = x;
118  this->InternalFloatPoint[1] = y;
119  this->InternalFloatPoint[2] = z;
120  this->TransformNormal(this->InternalFloatPoint, this->InternalFloatPoint);
121  return this->InternalFloatPoint;
122  }
123  float* TransformFloatNormal(const float normal[3]) VTK_SIZEHINT(3)
124  {
125  return this->TransformFloatNormal(normal[0], normal[1], normal[2]);
126  }
128 
130 
134  double* TransformDoubleNormal(double x, double y, double z) VTK_SIZEHINT(3)
135  {
136  this->InternalDoublePoint[0] = x;
137  this->InternalDoublePoint[1] = y;
138  this->InternalDoublePoint[2] = z;
139  this->TransformNormal(this->InternalDoublePoint, this->InternalDoublePoint);
140  return this->InternalDoublePoint;
141  }
142  double* TransformDoubleNormal(const double normal[3]) VTK_SIZEHINT(3)
143  {
144  return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
145  }
147 
152  double* TransformVector(double x, double y, double z) VTK_SIZEHINT(3)
153  {
154  return this->TransformDoubleVector(x, y, z);
155  }
156  double* TransformVector(const double normal[3]) VTK_SIZEHINT(3)
157  {
158  return this->TransformDoubleVector(normal[0], normal[1], normal[2]);
159  }
160 
165  void TransformVector(const float in[3], float out[3])
166  {
167  this->Update();
168  this->InternalTransformVector(in, out);
169  }
170 
175  void TransformVector(const double in[3], double out[3])
176  {
177  this->Update();
178  this->InternalTransformVector(in, out);
179  }
180 
182 
186  float* TransformFloatVector(float x, float y, float z) VTK_SIZEHINT(3)
187  {
188  this->InternalFloatPoint[0] = x;
189  this->InternalFloatPoint[1] = y;
190  this->InternalFloatPoint[2] = z;
191  this->TransformVector(this->InternalFloatPoint, this->InternalFloatPoint);
192  return this->InternalFloatPoint;
193  }
194  float* TransformFloatVector(const float vec[3]) VTK_SIZEHINT(3)
195  {
196  return this->TransformFloatVector(vec[0], vec[1], vec[2]);
197  }
199 
201 
205  double* TransformDoubleVector(double x, double y, double z) VTK_SIZEHINT(3)
206  {
207  this->InternalDoublePoint[0] = x;
208  this->InternalDoublePoint[1] = y;
209  this->InternalDoublePoint[2] = z;
210  this->TransformVector(this->InternalDoublePoint, this->InternalDoublePoint);
211  return this->InternalDoublePoint;
212  }
213  double* TransformDoubleVector(const double vec[3]) VTK_SIZEHINT(3)
214  {
215  return this->TransformDoubleVector(vec[0], vec[1], vec[2]);
216  }
218 
223  void TransformPoints(vtkPoints* inPts, vtkPoints* outPts) override;
224 
229  virtual void TransformNormals(vtkDataArray* inNms, vtkDataArray* outNms);
230 
235  virtual void TransformVectors(vtkDataArray* inVrs, vtkDataArray* outVrs);
236 
242  vtkDataArray* outNms, vtkDataArray* inVrs, vtkDataArray* outVrs, int nOptionalVectors = 0,
243  vtkDataArray** inVrsArr = nullptr, vtkDataArray** outVrsArr = nullptr) override;
244 
250  {
251  return static_cast<vtkLinearTransform*>(this->GetInverse());
252  }
253 
255 
259  void InternalTransformPoint(const float in[3], float out[3]) override;
260  void InternalTransformPoint(const double in[3], double out[3]) override;
262 
264 
268  virtual void InternalTransformNormal(const float in[3], float out[3]);
269  virtual void InternalTransformNormal(const double in[3], double out[3]);
271 
273 
277  virtual void InternalTransformVector(const float in[3], float out[3]);
278  virtual void InternalTransformVector(const double in[3], double out[3]);
280 
282 
288  const float in[3], float out[3], float derivative[3][3]) override;
290  const double in[3], double out[3], double derivative[3][3]) override;
292 
293 protected:
294  vtkLinearTransform() = default;
295  ~vtkLinearTransform() override = default;
296 
297 private:
298  vtkLinearTransform(const vtkLinearTransform&) = delete;
299  void operator=(const vtkLinearTransform&) = delete;
300 };
301 
302 #endif
void Update()
Update the transform to account for any changes which have been made.
vtkAbstractTransform * GetInverse()
Get the inverse of this transform.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
superclass for homogeneous transformations
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract superclass for linear transformations
virtual void TransformVectors(vtkDataArray *inVrs, vtkDataArray *outVrs)
Apply the transformation to a series of vectors, and append the results to outVrs.
virtual void TransformNormals(vtkDataArray *inNms, vtkDataArray *outNms)
Apply the transformation to a series of normals, and append the results to outNms.
virtual void InternalTransformVector(const float in[3], float out[3])
This will calculate the transformation without calling Update.
void InternalTransformPoint(const float in[3], float out[3]) override
This will calculate the transformation without calling Update.
double * TransformNormal(double x, double y, double z)
Synonymous with TransformDoubleNormal(x,y,z).
double * TransformDoubleVector(double x, double y, double z)
Apply the transformation to a double-precision (x,y,z) vector.
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.
void TransformPoints(vtkPoints *inPts, vtkPoints *outPts) override
Apply the transformation to a series of points, and append the results to outPts.
float * TransformFloatNormal(float x, float y, float z)
Apply the transformation to an (x,y,z) normal.
void InternalTransformPoint(const double in[3], double out[3]) override
This will calculate the transformation without calling Update.
double * TransformDoubleVector(const double vec[3])
Apply the transformation to a double-precision (x,y,z) vector.
virtual void InternalTransformNormal(const float in[3], float out[3])
This will calculate the transformation without calling Update.
virtual void InternalTransformVector(const double in[3], double out[3])
This will calculate the transformation without calling Update.
vtkLinearTransform()=default
virtual void InternalTransformNormal(const double in[3], double out[3])
This will calculate the transformation without calling Update.
double * TransformVector(double x, double y, double z)
Synonymous with TransformDoubleVector(x,y,z).
float * TransformFloatNormal(const float normal[3])
Apply the transformation to an (x,y,z) normal.
~vtkLinearTransform() override=default
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.
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 TransformVector(const float in[3], float out[3])
Apply the transformation to a vector.
void TransformNormal(const float in[3], float out[3])
Apply the transformation to a normal.
void TransformVector(const double in[3], double out[3])
Apply the transformation to a double-precision vector.
float * TransformFloatVector(float x, float y, float z)
Apply the transformation to an (x,y,z) vector.
double * TransformDoubleNormal(const double normal[3])
Apply the transformation to a double-precision (x,y,z) normal.
double * TransformNormal(const double normal[3])
void InternalTransformDerivative(const double in[3], double out[3], double derivative[3][3]) override
This will calculate the transformation as well as its derivative without calling Update.
double * TransformVector(const double normal[3])
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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.
represent and manipulate 3D points
Definition: vtkPoints.h:149
#define VTK_SIZEHINT(...)