VTK  9.3.20240424
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
43#ifndef vtkLinearTransform_h
44#define vtkLinearTransform_h
45
46#include "vtkCommonTransformsModule.h" // For export macro
48#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
49
50VTK_ABI_NAMESPACE_BEGIN
51class VTKCOMMONTRANSFORMS_EXPORT VTK_MARSHALAUTO vtkLinearTransform : public vtkHomogeneousTransform
52{
53public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
61 void TransformNormal(const float in[3], float out[3])
62 {
63 this->Update();
64 this->InternalTransformNormal(in, out);
65 }
66
71 void TransformNormal(const double in[3], double out[3])
72 {
73 this->Update();
74 this->InternalTransformNormal(in, out);
75 }
76
81 double* TransformNormal(double x, double y, double z) VTK_SIZEHINT(3)
82 {
83 return this->TransformDoubleNormal(x, y, z);
84 }
85 double* TransformNormal(const double normal[3]) VTK_SIZEHINT(3)
86 {
87 return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
88 }
89
91
95 float* TransformFloatNormal(float x, float y, float z) VTK_SIZEHINT(3)
96 {
97 this->InternalFloatPoint[0] = x;
98 this->InternalFloatPoint[1] = y;
99 this->InternalFloatPoint[2] = z;
100 this->TransformNormal(this->InternalFloatPoint, this->InternalFloatPoint);
101 return this->InternalFloatPoint;
102 }
103 float* TransformFloatNormal(const float normal[3]) VTK_SIZEHINT(3)
104 {
105 return this->TransformFloatNormal(normal[0], normal[1], normal[2]);
106 }
108
110
114 double* TransformDoubleNormal(double x, double y, double z) VTK_SIZEHINT(3)
115 {
116 this->InternalDoublePoint[0] = x;
117 this->InternalDoublePoint[1] = y;
118 this->InternalDoublePoint[2] = z;
119 this->TransformNormal(this->InternalDoublePoint, this->InternalDoublePoint);
120 return this->InternalDoublePoint;
121 }
122 double* TransformDoubleNormal(const double normal[3]) VTK_SIZEHINT(3)
123 {
124 return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
125 }
127
132 double* TransformVector(double x, double y, double z) VTK_SIZEHINT(3)
133 {
134 return this->TransformDoubleVector(x, y, z);
135 }
136 double* TransformVector(const double normal[3]) VTK_SIZEHINT(3)
137 {
138 return this->TransformDoubleVector(normal[0], normal[1], normal[2]);
139 }
140
145 void TransformVector(const float in[3], float out[3])
146 {
147 this->Update();
148 this->InternalTransformVector(in, out);
149 }
150
155 void TransformVector(const double in[3], double out[3])
156 {
157 this->Update();
158 this->InternalTransformVector(in, out);
159 }
160
162
166 float* TransformFloatVector(float x, float y, float z) VTK_SIZEHINT(3)
167 {
168 this->InternalFloatPoint[0] = x;
169 this->InternalFloatPoint[1] = y;
170 this->InternalFloatPoint[2] = z;
171 this->TransformVector(this->InternalFloatPoint, this->InternalFloatPoint);
172 return this->InternalFloatPoint;
173 }
174 float* TransformFloatVector(const float vec[3]) VTK_SIZEHINT(3)
175 {
176 return this->TransformFloatVector(vec[0], vec[1], vec[2]);
177 }
179
181
185 double* TransformDoubleVector(double x, double y, double z) VTK_SIZEHINT(3)
186 {
187 this->InternalDoublePoint[0] = x;
188 this->InternalDoublePoint[1] = y;
189 this->InternalDoublePoint[2] = z;
190 this->TransformVector(this->InternalDoublePoint, this->InternalDoublePoint);
191 return this->InternalDoublePoint;
192 }
193 double* TransformDoubleVector(const double vec[3]) VTK_SIZEHINT(3)
194 {
195 return this->TransformDoubleVector(vec[0], vec[1], vec[2]);
196 }
198
203 void TransformPoints(vtkPoints* inPts, vtkPoints* outPts) override;
204
209 virtual void TransformNormals(vtkDataArray* inNms, vtkDataArray* outNms);
210
215 virtual void TransformVectors(vtkDataArray* inVrs, vtkDataArray* outVrs);
216
222 vtkDataArray* outNms, vtkDataArray* inVrs, vtkDataArray* outVrs, int nOptionalVectors = 0,
223 vtkDataArray** inVrsArr = nullptr, vtkDataArray** outVrsArr = nullptr) override;
224
230 {
231 return static_cast<vtkLinearTransform*>(this->GetInverse());
232 }
233
235
239 void InternalTransformPoint(const float in[3], float out[3]) override;
240 void InternalTransformPoint(const double in[3], double out[3]) override;
242
244
248 virtual void InternalTransformNormal(const float in[3], float out[3]);
249 virtual void InternalTransformNormal(const double in[3], double out[3]);
251
253
257 virtual void InternalTransformVector(const float in[3], float out[3]);
258 virtual void InternalTransformVector(const double in[3], double out[3]);
260
262
268 const float in[3], float out[3], float derivative[3][3]) override;
270 const double in[3], double out[3], double derivative[3][3]) override;
272
273protected:
275 ~vtkLinearTransform() override = default;
276
277private:
278 vtkLinearTransform(const vtkLinearTransform&) = delete;
279 void operator=(const vtkLinearTransform&) = delete;
280};
281
282VTK_ABI_NAMESPACE_END
283#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
superclass for homogeneous transformations
a simple class to control print indentation
Definition vtkIndent.h:108
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:139
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO