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

Method ShiftPosition

Rendering/Annotation/vtkAxisActor2D.cxx:1173–1187  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1171
1172//------------------------------------------------------------------------------
1173void vtkAxisActor2D::ShiftPosition(
1174 double xTick[3], double textAngle, int stringWidth, int stringHeight, int offset, int finalPos[2])
1175{
1176 // Text Horizontal: center text
1177 finalPos[0] = xTick[0] - stringWidth / 2 * std::cos(textAngle);
1178 finalPos[1] = xTick[1] - stringWidth / 2 * std::sin(textAngle);
1179
1180 // Text Vertical: put text "under" axes
1181 finalPos[0] += stringHeight * std::sin(textAngle);
1182 finalPos[1] -= stringHeight * std::cos(textAngle);
1183
1184 // Axis Vertical: add extra offset
1185 finalPos[0] += offset * std::sin(textAngle);
1186 finalPos[1] -= offset * std::cos(textAngle);
1187}
1188
1189//------------------------------------------------------------------------------
1190double vtkAxisActor2D::ComputeStringOffset(double width, double height, double theta)

Callers 1

BuildTitleMethod · 0.95

Calls 2

cosFunction · 0.50
sinFunction · 0.50

Tested by

no test coverage detected