MCPcopy Create free account
hub / github.com/Kitware/VTK / InternalUpdate

Method InternalUpdate

Common/Transforms/vtkTransform.cxx:145–221  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

143
144//------------------------------------------------------------------------------
145void vtkTransform::InternalUpdate()
146{
147 int i;
148 int nTransforms = this->Concatenation->GetNumberOfTransforms();
149 int nPreTransforms = this->Concatenation->GetNumberOfPreTransforms();
150
151 // check to see whether someone has been fooling around with our matrix
152 int doTheLegacyHack = 0;
153 if (this->Matrix->GetMTime() > this->MatrixUpdateMTime)
154 {
155 vtkDebugMacro(<< "InternalUpdate: this->Matrix was modified by something other than 'this'");
156
157 // check to see if we have any inputs or concatenated transforms
158 int isPipelined = (this->Input != nullptr);
159 for (i = 0; i < nTransforms && !isPipelined; i++)
160 { // the vtkSimpleTransform is just a matrix placeholder,
161 // it is not a real transform
162 isPipelined = !this->Concatenation->GetTransform(i)->IsA("vtkSimpleTransform");
163 }
164 // do the legacy hack only if we have no input transforms
165 doTheLegacyHack = !isPipelined;
166 }
167
168 // copy matrix from input
169 if (this->Input)
170 {
171 this->Matrix->DeepCopy(this->Input->GetMatrix());
172 // if inverse flag is set, invert the matrix
173 if (this->Concatenation->GetInverseFlag())
174 {
175 this->Matrix->Invert();
176 }
177 }
178 else if (doTheLegacyHack)
179 {
180 vtkWarningMacro("InternalUpdate: doing hack to support legacy code. "
181 "This is deprecated in VTK 4.2. May be removed in a "
182 "future version.");
183 // this heuristic works perfectly if GetMatrix() or GetMatrixPointer()
184 // was called immediately prior to the matrix modifications
185 // (fortunately, this is almost always the case)
186 if (this->Matrix->GetMTime() > this->Concatenation->GetMaxMTime())
187 { // don't apply operations that occurred after matrix modification
188 nPreTransforms = nTransforms = 0;
189 }
190 }
191 else
192 { // otherwise, we start with the identity transform as our base
193 this->Matrix->Identity();
194 }
195
196 // concatenate PreTransforms
197 for (i = nPreTransforms - 1; i >= 0; i--)
198 {
199 vtkHomogeneousTransform* transform =
200 static_cast<vtkHomogeneousTransform*>(this->Concatenation->GetTransform(i));
201 vtkMatrix4x4::Multiply4x4(this->Matrix, transform->GetMatrix(), this->Matrix);
202 }

Callers 1

UpdateMethod · 0.45

Calls 9

IsAMethod · 0.80
GetMaxMTimeMethod · 0.80
GetNumberOfTransformsMethod · 0.45
GetMTimeMethod · 0.45
GetTransformMethod · 0.45
DeepCopyMethod · 0.45
GetMatrixMethod · 0.45
InvertMethod · 0.45
IdentityMethod · 0.45

Tested by

no test coverage detected