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

Method SetOffsetPosition

Rendering/Annotation/vtkAxisActor2D.cxx:1154–1170  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Position text with respect to a point (xTick) where the angle of the line from the point to the center of the text is given by theta. The offset is the spacing between ticks and labels.

Source from the content-addressed store, hash-verified

1152// from the point to the center of the text is given by theta. The offset
1153// is the spacing between ticks and labels.
1154void vtkAxisActor2D::SetOffsetPosition(
1155 double xTick[3], double theta, int stringWidth, int stringHeight, int offset, vtkActor2D* actor)
1156{
1157 double x, y, center[2];
1158 int pos[2];
1159
1160 x = stringWidth / 2.0 + offset;
1161 y = stringHeight / 2.0 + offset;
1162
1163 center[0] = xTick[0] + x * std::sin(theta);
1164 center[1] = xTick[1] - y * std::cos(theta);
1165
1166 pos[0] = static_cast<int>(center[0] - stringWidth / 2.0);
1167 pos[1] = static_cast<int>(center[1] - stringHeight / 2.0);
1168
1169 actor->SetPosition(pos[0], pos[1]);
1170}
1171
1172//------------------------------------------------------------------------------
1173void vtkAxisActor2D::ShiftPosition(

Callers

nothing calls this directly

Calls 3

sinFunction · 0.50
cosFunction · 0.50
SetPositionMethod · 0.45

Tested by

no test coverage detected