I am using vtkCubeAxesActor (VTK-9.2.0) to enclose a topographic surface.
Depending on scene zoom, the axis ticks and their labels are sometimes too crowded. E.g. in this view, the ticks and their labels are spaced too closely along the z-axis (“Topography”):
My code which sets up the axes is here and is probably too simplistic:
axesActor->SetUseTextActor3D(0);
// Bound by DEM surface extents
axesActor->SetBounds(surfaceBounds);
axesActor->SetXAxisRange(gridBounds[0], gridBounds[1]);
axesActor->SetYAxisRange(gridBounds[2], gridBounds[3]);
axesActor->SetZAxisRange(gridBounds[4], gridBounds[5]);
// Set axes colors
axesActor->GetTitleTextProperty(0)->SetColor(axisColor.GetData());
axesActor->GetTitleTextProperty(0)->SetFontSize(48);
axesActor->GetLabelTextProperty(0)->SetColor(axisColor.GetData());
axesActor->GetTitleTextProperty(1)->SetColor(axisColor.GetData());
axesActor->GetLabelTextProperty(1)->SetColor(axisColor.GetData());
axesActor->GetTitleTextProperty(2)->SetColor(axisColor.GetData());
axesActor->GetLabelTextProperty(2)->SetColor(axisColor.GetData());
axesActor->GetXAxesLinesProperty()->SetColor(axisColor.GetData());
axesActor->GetYAxesLinesProperty()->SetColor(axisColor.GetData());
axesActor->GetZAxesLinesProperty()->SetColor(axisColor.GetData());
axesActor->DrawXGridlinesOn();
axesActor->DrawYGridlinesOn();
axesActor->DrawZGridlinesOn();
// Set axes titles
axesActor->SetXTitle(xUnits);
axesActor->SetYTitle(yUnits);
axesActor->SetZTitle(zUnits);
// Don’t draw minor ticks
axesActor->XAxisMinorTickVisibilityOff();
axesActor->YAxisMinorTickVisibilityOff();
axesActor->ZAxisMinorTickVisibilityOff();
How do I control the spacing depending on zoom, so that axis ticks are uncluttered? I couldn’t find an example, and the vtkCubeAxesActor documentation is not too clear on this.
Thanks!