vtkAxesActor Fails to Render at Some Angles

After upgrading from 8.2.0 to 9.0.1, VTK AxesActors do not render at certain
angles. Here is a Python script that demonstrates this:

 # This script demonstrates that the vtkAxesActor is not drawn between phi = 91 degrees and 261 degrees.

import math
from typing import List
import vtk

def main():

    # set the camera angle
    camera = vtk.vtkCamera()
    camera.SetPosition(10., 10., 20.)
    camera.SetViewUp(0., 1., 0.)
    camera.SetFocalPoint(0., 2., 0.)

    # create renderer
    renderer = vtk.vtkRenderer()
    renderer.SetActiveCamera(camera)

    # set spherical angles
    radius = 2.0

    phi = [0.0, 45.0, 91.0, 135.0, 180.0, 225.0, 261.0, 315.0]
    pCount = len(phi)
    theta = [45.0]*pCount

    # loop over the number of angles
    for i in range(0, pCount):
        rPosition = spherical2Rectangular(radius, theta[i], phi[i])

        # create transform to rotate the axes based on the spherical angles
        transform = vtk.vtkTransform()
        transform.Translate(rPosition[0], rPosition[1], rPosition[2])
        transform.Scale(0.2, 0.2, 0.2)
        transform.RotateZ(180.0+phi[i])
        transform.RotateY(-180.0-theta[i])
        transform.RotateZ(-90.0)

        # create axis actor
        srcActor = vtk.vtkAxesActor()
        srcActor.SetUserTransform(transform)
        srcActor.SetXAxisLabelText("")
        srcActor.SetYAxisLabelText("")
        srcActor.SetZAxisLabelText("")

        renderer.AddActor(srcActor)

        # Axis label
        textActor = vtk.vtkBillboardTextActor3D()
        textActor.SetInput("I_" + str(int(phi[i])))
        textActor.SetPosition(rPosition[0], rPosition[1], rPosition[2])
        textActor.GetTextProperty().SetFontSize(24)
        textActor.GetTextProperty().SetJustificationToCentered()
        textActor.SetScale(5.0, 5.0, 5.0)

        renderer.AddActor(textActor)

    # create render window
    renWin = vtk.vtkRenderWindow()
    renWin.SetSize(1200,1200)

    # create render window interactor
    renderWindowInteractor = vtk.vtkRenderWindowInteractor()
    renderWindowInteractor.SetRenderWindow(renWin)
    renderWindowInteractor.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())

    # add renderer to render windows
    renWin.AddRenderer(renderer)
    renWin.Render()

    # Begin mouse interaction
    renderWindowInteractor.Start()

def spherical2Rectangular(radius: float, thetaD: float, phiD: float) -> List[float]:
    theta = thetaD*(math.pi / 180.0)
    phi = phiD*(math.pi / 180.0)

    x = radius * math.sin(theta) * math.cos(phi)
    y = radius * math.sin(theta) * math.sin(phi)
    z = radius * math.cos(theta)

    return [x, y, z]

if __name__ == '__main__':
    main()

Here are the results for 9.0.1:

Here are the results for 8.2.0:

Is there anything I’m missing?

Thanks.

Ok, I can confirm that after modifying your camera parameters as follows:

    camera.SetPosition(-0.308454, -4.328727, 6.006257)
    camera.SetFocalPoint(0.073685, 0.471175, 0.624938)
    camera.SetViewUp(0.085563, 0.740509, 0.666578)
    camera.SetDistance(7.221058)
    camera.SetClippingRange(3.089628, 12.804766)

I get an image much like yours with missing axes for I_91 … I_261. These missing axes briefly appear then disappear when rendered. @ben.boeckel, @ken-martin any ideas?