Clear Filters
Clear Filters

Cannot select all points in view in brush mode

3 views (last 30 days)
Under certain camera conditions while viewing a pointcloud with pcshow, I cannot select all points in view with the brush. (The same thing happens with using scatter3 -- see the comments)
Here's an example:
pts = [2*rand(200000,1)-0.6981, ...
(2*rand(200000,1)+0.000412), ...
(0.03*rand(200000,1)-0.00202)];
figure;
ax = pcshow(pts,'MarkerSize',20);
ax.CameraPosition = [0.2387 0.0725 0.01536];
ax.CameraViewAngle = 60;
ax.CameraTarget = [-0.1620 0.1982 -0.01704];
ax.CameraUpVector = [-0.2694 0.1696 0.9480];
Using the "Brush Data" mode, I can only select points in roughly the middle 1/3 of the screen. The red rectangle indicating the selection just does't follow the mouse pointer in the top or bottom portion of the screen and I can't select any points in those areas.
However, if I change the camera position
ax.CameraPosition = [0 0 0];
ax.CameraTarget = [0 1 0];
ax.CameraUpVector = [0 0 1];
I can select any points in view and the red rectangle accompanies the mouse pointer as normal. What's going on?
  2 Comments
John Barrus
John Barrus on 25 Sep 2023
It seems like the issue is somewhere in R2023a\toolbox\matlab\datamanager\+datamanager\brushdrag.m. At line 16, no axes are returned here for the case described above.
John Barrus
John Barrus on 25 Sep 2023
Reproducing the same erroneous behavior with scatter3:
pts = [2*rand(200000,1)-0.6981, ...
(2*rand(200000,1)+0.000412), ...
(0.03*rand(200000,1)-0.00202)];
figure;
h = scatter3(pts(:,1),pts(:,2),pts(:,3));
ax = h.Parent;
ax.DataAspectRatio = [1,1,1];
ax.PlotBoxAspectRatio = [66.6650 66.6664 1];
ax.Projection = 'perspective';
ax.CameraPosition = [0.2387 0.0725 0.01536];
ax.CameraViewAngle = 60;
ax.CameraTarget = [-0.1620 0.1982 -0.01704];
ax.CameraUpVector = [-0.2694 0.1696 0.9480];

Sign in to comment.

Answers (1)

Milan Bansal
Milan Bansal on 4 Oct 2023
Hi,
As per my understanding, you are not able to select all the points present in the figure window using "Brush Data" feature.
Using "Brush Data" feature, it is only possible to select the data which falls under the field of view of the camera. The view displayed in the figure window, and the view seen by the camera are not always the same, the view seen by camera depends upon several factor such as "CameraPositon", "CameraTarget" and "CameraViewingAngle". Please refer to the following documentation link for further information on the above properties.
When selecting the points using "Brush Data" feature, the points in the front of the camera and back of the camera gets selected which fall under the field of view. It is possible to verify this by zooming out and changing the position using "3D Rotate" feature.
Please note that using "3D rotate" will change the position of the camera and hence the current view.
Please refer the figure below to see exactly which points were selected using the initial set of camera positions.
Please refer the figure below to see exactly which points were selected using the second set of camera positions.
From first figure it looks like all the points were selected but actually only those points were selected which were present in the field of view of camera.
In order to select all the points, set the "CameraPosition" such that whole view falls under the field of view of camera. Please refer to the example below set the camera position.
ax.CameraPosition = [-0.8 -0.76 0];
ax.CameraTarget = [0 1 0];
ax.CameraUpVector = [0 0 1];
ax.CameraViewAngle = 60;
Please refer to the below MathWorks documentation link to learn more about Camera Graphics Terminologies.
Hope it helps.

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!