Centre camera to clicked sphere

I have an application where there are multiple (10k+) spheres rendered. I would like the camera to focus on a particular sphere when the user selects the point, i.e. centre the sphere on screen and zoom to a distance of X.

I am unable to find an example of such using VTK.js. Would someone be able to point me in the right direction?

Currently I am not implementing a vtkCamera but my guess is that this will need to be added to my vtkRenderer and then amend the position etc based on the selected point?

Untested, but a quick test approach would be to call renderer.resetCamera(spherePolyData.getBounds()).

Manually, this can be done with just camera operations. I will assume that you are in perspective projection, and moving to a sphere does not modify the camera’s direction of projection vector, nor the camera’s viewUp vector. Given some fixed distance to the sphere, you will need to set the camera’s focalPoint to the sphere center, the camera’s position to focalPoint - distance * directionOfProjection, and the viewAngle to achieve your desired zoom.

Animating this would require linear interpolation and moving the camera in steps.