Making 3d/2d pointcloud fill window without border/bounding cube


I’m working on an application that displays a LIDAR pointcloud using VTK. It displays the pointcloud in both a 3D view and a 2D overhead view.

I initially tried using vtkChartXY and vtkChartXYZ, though I want to use the full renderwing window, and really don’t want axes or a bounding cube. It seems the former can be hidden, but not the latter in the case of vtkChartXYZ. Also, in vtkChartXYZ, it seems the cube won’t automatically fit the window even with setFitToScene on - you have to set geometry or you don’t see anything (and resizing makes the size awkward). As such, I moved to simply using a vtkActor added to a renderer with a vtkPolyDataMapper and vtkTableToPolyData (to use table data).

This works more like what I want (not having the cube or geometry issues), but the default view seems to be zoomed a ways out compared to the size of the window. I tried setting the camera’s bounds, but it seems there is always a significant border around the image. Also, I was unable to replicate this for the 2D pointcloud with vtkActor2D (it seems to insist on data coordinates being pixel coordinates) - for now I’m just using a vtkActor and disabling the interactivity, but I have the same border issue there (and am rendering 3D data I don’t need there).

Any idea what I could do here to get my plots to use the full window? I’m using Python, fyi…

I tried a few more things, and found that when using a vtkActor added to a renderer, the camera’s Zoom function applies a zoom factor to the current camera view. I was able to use this to get the right zoom level by guesstimating the right zoom factor and hard-coding it. However, this isn’t the most robust solution, as it wouldn’t work for data sets that are significantly different.

How would I set the camera parameters such that the window tightly fits my vtkActor in the default (overhead) view in the y direction, with no extra space along the top and bottom edges (extra space in the X direction is expected)?

I suspect this involves set some combination of focal point, position, distance, and view angle (as vtkRenderer.ResetCamera() uses), but not sure how to actually get this from my data bounds (the aforementioned ResetCamera function leaves extra space on top and bottom)