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

Method ComputerAutoCenterTranslation

Rendering/Annotation/vtkAxisFollower.cxx:353–388  ·  view source on GitHub ↗

------------------------------------------------------------------------------ VTK_DEPRECATED_IN_9_6_0

Source from the content-addressed store, hash-verified

351//------------------------------------------------------------------------------
352// VTK_DEPRECATED_IN_9_6_0
353void vtkAxisFollower::ComputerAutoCenterTranslation(
354 const double& vtkNotUsed(autoScaleFactor), double translation[3])
355{
356 if (!translation)
357 {
358 vtkErrorMacro("ERROR: Invalid or nullptr translation\n");
359 return;
360 }
361
362 const double* bounds = this->GetMapper()->GetBounds();
363
364 // Offset by half of width.
365 double halfWidth = (bounds[1] - bounds[0]) * 0.5 * this->Scale[0];
366
367 if (this->TextUpsideDown == 1)
368 {
369 halfWidth = -halfWidth;
370 }
371
372 if (this->Axis->GetAxisType() == vtkAxisActor::VTK_AXIS_TYPE_X)
373 {
374 translation[0] = translation[0] - halfWidth;
375 }
376 else if (this->Axis->GetAxisType() == vtkAxisActor::VTK_AXIS_TYPE_Y)
377 {
378 translation[1] = translation[1] - halfWidth;
379 }
380 else if (this->Axis->GetAxisType() == vtkAxisActor::VTK_AXIS_TYPE_Z)
381 {
382 translation[2] = translation[2] - halfWidth;
383 }
384 else
385 {
386 // Do nothing.
387 }
388}
389
390//------------------------------------------------------------------------------
391int vtkAxisFollower::TestDistanceVisibility()

Callers

nothing calls this directly

Calls 2

GetMapperMethod · 0.80
GetBoundsMethod · 0.45

Tested by

no test coverage detected