------------------------------------------------------------------------------
| 345 | |
| 346 | //------------------------------------------------------------------------------ |
| 347 | void vtkTransformInterpolator::InterpolateTransform(double t, vtkTransform* xform) |
| 348 | { |
| 349 | if (this->TransformList->empty()) |
| 350 | { |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | // Make sure the xform and this class are initialized properly |
| 355 | xform->Identity(); |
| 356 | this->InitializeInterpolation(); |
| 357 | |
| 358 | // Evaluate the interpolators |
| 359 | if (t < this->TransformList->front().Time) |
| 360 | { |
| 361 | t = this->TransformList->front().Time; |
| 362 | } |
| 363 | |
| 364 | else if (t > this->TransformList->back().Time) |
| 365 | { |
| 366 | t = this->TransformList->back().Time; |
| 367 | } |
| 368 | |
| 369 | double P[3], S[3], Q[4]; |
| 370 | vtkQuaterniond q; |
| 371 | this->PositionInterpolator->InterpolateTuple(t, P); |
| 372 | this->ScaleInterpolator->InterpolateTuple(t, S); |
| 373 | this->RotationInterpolator->InterpolateQuaternion(t, q); |
| 374 | Q[0] = vtkMath::DegreesFromRadians(q.GetRotationAngleAndAxis(Q + 1)); |
| 375 | |
| 376 | xform->Translate(P); |
| 377 | xform->RotateWXYZ(Q[0], Q + 1); |
| 378 | xform->Scale(S); |
| 379 | } |
| 380 | |
| 381 | //------------------------------------------------------------------------------ |
| 382 | void vtkTransformInterpolator::PrintSelf(ostream& os, vtkIndent indent) |