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

Method GetViewportRulerDistance

Rendering/Annotation/vtkAxisActor2D.cxx:596–609  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

594
595//------------------------------------------------------------------------------
596double vtkAxisActor2D::GetViewportRulerDistance(vtkViewport* viewport)
597{
598 double wp1[3], wp2[3], wp21[3];
599 this->PositionCoordinate->GetValue(wp1);
600 this->Position2Coordinate->GetValue(wp2);
601 vtkMath::Subtract(wp2, wp1, wp21);
602
603 const double worldLength = vtkMath::Norm(wp21);
604 // Tick distance was computed in world coordinates, convert to viewport
605 // coordinates.
606 double length = this->GetViewportAxisLength(viewport);
607 const double worldToLocalRatio = (worldLength <= 0.0 ? 0.0 : length / worldLength);
608 return this->RulerDistance * worldToLocalRatio;
609}
610
611//------------------------------------------------------------------------------
612double vtkAxisActor2D::GetAxisAngle(vtkViewport* viewport)

Callers 1

Calls 4

GetViewportAxisLengthMethod · 0.95
SubtractFunction · 0.50
NormFunction · 0.50
GetValueMethod · 0.45

Tested by

no test coverage detected