forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkLinearTransform.h
270 lines (241 loc) · 8.23 KB
/
vtkLinearTransform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/*=========================================================================
Program: Visualization Toolkit
Module: vtkLinearTransform.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkLinearTransform
* @brief abstract superclass for linear transformations
*
* vtkLinearTransform provides a generic interface for linear
* (affine or 12 degree-of-freedom) geometric transformations.
*
* @warning
* Portions of this class (i.e., when transforming arrays of points and/or
* associated attributes such as normals and vectors) has been threaded with
* vtkSMPTools. Using TBB or other non-sequential type (set in the CMake
* variable VTK_SMP_IMPLEMENTATION_TYPE) may improve performance
* significantly.
*
* @sa
* vtkTransform vtkIdentityTransform
*/
#ifndef vtkLinearTransform_h
#define vtkLinearTransform_h
#include "vtkCommonTransformsModule.h" // For export macro
#include "vtkHomogeneousTransform.h"
class VTKCOMMONTRANSFORMS_EXPORT vtkLinearTransform : public vtkHomogeneousTransform
{
public:
vtkTypeMacro(vtkLinearTransform, vtkHomogeneousTransform);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Apply the transformation to a normal.
* You can use the same array to store both the input and output.
*/
void TransformNormal(const float in[3], float out[3])
{
this->Update();
this->InternalTransformNormal(in, out);
}
/**
* Apply the transformation to a double-precision normal.
* You can use the same array to store both the input and output.
*/
void TransformNormal(const double in[3], double out[3])
{
this->Update();
this->InternalTransformNormal(in, out);
}
/**
* Synonymous with TransformDoubleNormal(x,y,z).
* Use this if you are programming in python or Java.
*/
double* TransformNormal(double x, double y, double z) VTK_SIZEHINT(3)
{
return this->TransformDoubleNormal(x, y, z);
}
double* TransformNormal(const double normal[3]) VTK_SIZEHINT(3)
{
return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
}
///@{
/**
* Apply the transformation to an (x,y,z) normal.
* Use this if you are programming in python or Java.
*/
float* TransformFloatNormal(float x, float y, float z) VTK_SIZEHINT(3)
{
this->InternalFloatPoint[0] = x;
this->InternalFloatPoint[1] = y;
this->InternalFloatPoint[2] = z;
this->TransformNormal(this->InternalFloatPoint, this->InternalFloatPoint);
return this->InternalFloatPoint;
}
float* TransformFloatNormal(const float normal[3]) VTK_SIZEHINT(3)
{
return this->TransformFloatNormal(normal[0], normal[1], normal[2]);
}
///@}
///@{
/**
* Apply the transformation to a double-precision (x,y,z) normal.
* Use this if you are programming in python or Java.
*/
double* TransformDoubleNormal(double x, double y, double z) VTK_SIZEHINT(3)
{
this->InternalDoublePoint[0] = x;
this->InternalDoublePoint[1] = y;
this->InternalDoublePoint[2] = z;
this->TransformNormal(this->InternalDoublePoint, this->InternalDoublePoint);
return this->InternalDoublePoint;
}
double* TransformDoubleNormal(const double normal[3]) VTK_SIZEHINT(3)
{
return this->TransformDoubleNormal(normal[0], normal[1], normal[2]);
}
///@}
/**
* Synonymous with TransformDoubleVector(x,y,z).
* Use this if you are programming in python or Java.
*/
double* TransformVector(double x, double y, double z) VTK_SIZEHINT(3)
{
return this->TransformDoubleVector(x, y, z);
}
double* TransformVector(const double normal[3]) VTK_SIZEHINT(3)
{
return this->TransformDoubleVector(normal[0], normal[1], normal[2]);
}
/**
* Apply the transformation to a vector.
* You can use the same array to store both the input and output.
*/
void TransformVector(const float in[3], float out[3])
{
this->Update();
this->InternalTransformVector(in, out);
}
/**
* Apply the transformation to a double-precision vector.
* You can use the same array to store both the input and output.
*/
void TransformVector(const double in[3], double out[3])
{
this->Update();
this->InternalTransformVector(in, out);
}
///@{
/**
* Apply the transformation to an (x,y,z) vector.
* Use this if you are programming in python or Java.
*/
float* TransformFloatVector(float x, float y, float z) VTK_SIZEHINT(3)
{
this->InternalFloatPoint[0] = x;
this->InternalFloatPoint[1] = y;
this->InternalFloatPoint[2] = z;
this->TransformVector(this->InternalFloatPoint, this->InternalFloatPoint);
return this->InternalFloatPoint;
}
float* TransformFloatVector(const float vec[3]) VTK_SIZEHINT(3)
{
return this->TransformFloatVector(vec[0], vec[1], vec[2]);
}
///@}
///@{
/**
* Apply the transformation to a double-precision (x,y,z) vector.
* Use this if you are programming in python or Java.
*/
double* TransformDoubleVector(double x, double y, double z) VTK_SIZEHINT(3)
{
this->InternalDoublePoint[0] = x;
this->InternalDoublePoint[1] = y;
this->InternalDoublePoint[2] = z;
this->TransformVector(this->InternalDoublePoint, this->InternalDoublePoint);
return this->InternalDoublePoint;
}
double* TransformDoubleVector(const double vec[3]) VTK_SIZEHINT(3)
{
return this->TransformDoubleVector(vec[0], vec[1], vec[2]);
}
///@}
/**
* Apply the transformation to a series of points, and append the
* results to outPts.
*/
void TransformPoints(vtkPoints* inPts, vtkPoints* outPts) override;
/**
* Apply the transformation to a series of normals, and append the
* results to outNms.
*/
virtual void TransformNormals(vtkDataArray* inNms, vtkDataArray* outNms);
/**
* Apply the transformation to a series of vectors, and append the
* results to outVrs.
*/
virtual void TransformVectors(vtkDataArray* inVrs, vtkDataArray* outVrs);
/**
* Apply the transformation to a combination of points, normals
* and vectors.
*/
void TransformPointsNormalsVectors(vtkPoints* inPts, vtkPoints* outPts, vtkDataArray* inNms,
vtkDataArray* outNms, vtkDataArray* inVrs, vtkDataArray* outVrs, int nOptionalVectors = 0,
vtkDataArray** inVrsArr = nullptr, vtkDataArray** outVrsArr = nullptr) override;
/**
* Just like GetInverse, but it includes a typecast to
* vtkLinearTransform.
*/
vtkLinearTransform* GetLinearInverse()
{
return static_cast<vtkLinearTransform*>(this->GetInverse());
}
///@{
/**
* This will calculate the transformation without calling Update.
* Meant for use only within other VTK classes.
*/
void InternalTransformPoint(const float in[3], float out[3]) override;
void InternalTransformPoint(const double in[3], double out[3]) override;
///@}
///@{
/**
* This will calculate the transformation without calling Update.
* Meant for use only within other VTK classes.
*/
virtual void InternalTransformNormal(const float in[3], float out[3]);
virtual void InternalTransformNormal(const double in[3], double out[3]);
///@}
///@{
/**
* This will calculate the transformation without calling Update.
* Meant for use only within other VTK classes.
*/
virtual void InternalTransformVector(const float in[3], float out[3]);
virtual void InternalTransformVector(const double in[3], double out[3]);
///@}
///@{
/**
* This will calculate the transformation as well as its derivative
* without calling Update. Meant for use only within other VTK
* classes.
*/
void InternalTransformDerivative(
const float in[3], float out[3], float derivative[3][3]) override;
void InternalTransformDerivative(
const double in[3], double out[3], double derivative[3][3]) override;
///@}
protected:
vtkLinearTransform() = default;
~vtkLinearTransform() override = default;
private:
vtkLinearTransform(const vtkLinearTransform&) = delete;
void operator=(const vtkLinearTransform&) = delete;
};
#endif