VTK  9.1.0
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=========================================================================*/
62#ifndef vtkLinearTransform_h
63#define vtkLinearTransform_h
64
65#include "vtkCommonTransformsModule.h" // For export macro
67
68class VTKCOMMONTRANSFORMS_EXPORT vtkLinearTransform : public vtkHomogeneousTransform
69{
70public:
72 void PrintSelf(ostream& os, vtkIndent indent) override;
73
78 void TransformNormal(const float in[3], float out[3])
79 {
80 this->Update();
81 this->InternalTransformNormal(in, out);
82 }
83
88 void TransformNormal(const double in[3], double out[3])
89 {
90 this->Update();
91 this->InternalTransformNormal(in, out);
92 }
93
98 double* TransformNormal(double x, double y, double z) VTK_SIZEHINT(3)
99 {
100 return this->TransformDoubleNormal(x, y, z);
101 }
102 double* TransformNormal(const double normal[3]) VTK_SIZEHINT(3)
103 {
104 return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
105 }
106
108
112 float* TransformFloatNormal(float x, float y, float z) VTK_SIZEHINT(3)
113 {
114 this->InternalFloatPoint[0] = x;
115 this->InternalFloatPoint[1] = y;
116 this->InternalFloatPoint[2] = z;
117 this->TransformNormal(this->InternalFloatPoint, this->InternalFloatPoint);
118 return this->InternalFloatPoint;
119 }
120 float* TransformFloatNormal(const float normal[3]) VTK_SIZEHINT(3)
121 {
122 return this->TransformFloatNormal(normal[0], normal[1], normal[2]);
123 }
125
127
131 double* TransformDoubleNormal(double x, double y, double z) VTK_SIZEHINT(3)
132 {
133 this->InternalDoublePoint[0] = x;
134 this->InternalDoublePoint[1] = y;
135 this->InternalDoublePoint[2] = z;
136 this->TransformNormal(this->InternalDoublePoint, this->InternalDoublePoint);
137 return this->InternalDoublePoint;
138 }
139 double* TransformDoubleNormal(const double normal[3]) VTK_SIZEHINT(3)
140 {
141 return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
142 }
144
149 double* TransformVector(double x, double y, double z) VTK_SIZEHINT(3)
150 {
151 return this->TransformDoubleVector(x, y, z);
152 }
153 double* TransformVector(const double normal[3]) VTK_SIZEHINT(3)
154 {
155 return this->TransformDoubleVector(normal[0], normal[1], normal[2]);
156 }
157
162 void TransformVector(const float in[3], float out[3])
163 {
164 this->Update();
165 this->InternalTransformVector(in, out);
166 }
167
172 void TransformVector(const double in[3], double out[3])
173 {
174 this->Update();
175 this->InternalTransformVector(in, out);
176 }
177
179
183 float* TransformFloatVector(float x, float y, float z) VTK_SIZEHINT(3)
184 {
185 this->InternalFloatPoint[0] = x;
186 this->InternalFloatPoint[1] = y;
187 this->InternalFloatPoint[2] = z;
188 this->TransformVector(this->InternalFloatPoint, this->InternalFloatPoint);
189 return this->InternalFloatPoint;
190 }
191 float* TransformFloatVector(const float vec[3]) VTK_SIZEHINT(3)
192 {
193 return this->TransformFloatVector(vec[0], vec[1], vec[2]);
194 }
196
198
202 double* TransformDoubleVector(double x, double y, double z) VTK_SIZEHINT(3)
203 {
204 this->InternalDoublePoint[0] = x;
205 this->InternalDoublePoint[1] = y;
206 this->InternalDoublePoint[2] = z;
207 this->TransformVector(this->InternalDoublePoint, this->InternalDoublePoint);
208 return this->InternalDoublePoint;
209 }
210 double* TransformDoubleVector(const double vec[3]) VTK_SIZEHINT(3)
211 {
212 return this->TransformDoubleVector(vec[0], vec[1], vec[2]);
213 }
215
220 void TransformPoints(vtkPoints* inPts, vtkPoints* outPts) override;
221
226 virtual void TransformNormals(vtkDataArray* inNms, vtkDataArray* outNms);
227
232 virtual void TransformVectors(vtkDataArray* inVrs, vtkDataArray* outVrs);
233
239 vtkDataArray* outNms, vtkDataArray* inVrs, vtkDataArray* outVrs, int nOptionalVectors = 0,
240 vtkDataArray** inVrsArr = nullptr, vtkDataArray** outVrsArr = nullptr) override;
241
247 {
248 return static_cast<vtkLinearTransform*>(this->GetInverse());
249 }
250
252
256 void InternalTransformPoint(const float in[3], float out[3]) override;
257 void InternalTransformPoint(const double in[3], double out[3]) override;
259
261
265 virtual void InternalTransformNormal(const float in[3], float out[3]);
266 virtual void InternalTransformNormal(const double in[3], double out[3]);
268
270
274 virtual void InternalTransformVector(const float in[3], float out[3]);
275 virtual void InternalTransformVector(const double in[3], double out[3]);
277
279
285 const float in[3], float out[3], float derivative[3][3]) override;
287 const double in[3], double out[3], double derivative[3][3]) override;
289
290protected:
292 ~vtkLinearTransform() override = default;
293
294private:
295 vtkLinearTransform(const vtkLinearTransform&) = delete;
296 void operator=(const vtkLinearTransform&) = delete;
297};
298
299#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:159
superclass for homogeneous transformations
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract superclass for linear transformations
double * TransformNormal(const double normal[3])
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.
float * TransformFloatVector(float x, float y, float z)
Apply the transformation to an (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.
double * TransformVector(const double normal[3])
void TransformPoints(vtkPoints *inPts, vtkPoints *outPts) override
Apply the transformation to a series of points, and append the results to outPts.
double * TransformDoubleNormal(double x, double y, double z)
Apply the transformation to a double-precision (x,y,z) normal.
void InternalTransformPoint(const double in[3], double out[3]) override
This will calculate the transformation without calling Update.
virtual void InternalTransformNormal(const float in[3], float out[3])
This will calculate the transformation without calling Update.
double * TransformDoubleVector(double x, double y, double z)
Apply the transformation to a double-precision (x,y,z) vector.
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 * TransformDoubleNormal(const double normal[3])
Apply the transformation to a double-precision (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.
float * TransformFloatNormal(float x, float y, float z)
Apply the transformation to an (x,y,z) normal.
double * TransformNormal(double x, double y, double z)
Synonymous with TransformDoubleNormal(x,y,z).
void TransformVector(const float in[3], float out[3])
Apply the transformation to a vector.
vtkLinearTransform * GetLinearInverse()
Just like GetInverse, but it includes a typecast to vtkLinearTransform.
void TransformNormal(const float in[3], float out[3])
Apply the transformation to a normal.
float * TransformFloatVector(const float vec[3])
Apply the transformation to an (x,y,z) vector.
void TransformVector(const double in[3], double out[3])
Apply the transformation to a double-precision vector.
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.
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.
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 * TransformDoubleVector(const double vec[3])
Apply the transformation to a double-precision (x,y,z) vector.
represent and manipulate 3D points
Definition: vtkPoints.h:143
#define VTK_SIZEHINT(...)