# Zoom Close To Data

This post is here to talk about a new button to zoom close to the active data.

The already existing “Zoom To Data” button computes the camera distance as a constant that depends on the radius of the bounding box. The problem with this behavior is when the user wants to view a data described by an elongated bounding box : when the view is oriented along the direction of the bounding box, the button do not really “zoom” to data as the distance of the camera is very large due to the size of the bounding box.

The image below explains this behavior. Each column represent 3 angles of view of a fixed length cylinder (length = 1 to length = 100 from left to right). You can notice that in the bottom image of the longest cylinder, the view could zoom in a lot more to fit the data).

We propose here a new button “Zoom Close To Data” that fits the data in the screen in the direction of the view. The image below compare the button “Zoom To Data” (top row) and “Zoom Close To Data” (bottom row) for a cylinder with a length = 100

2 Likes

I think this is a good idea. One question: in the “Zoom Close To Data” example on the bottom right, why is the right side of the cylinder in the center of the image instead of the upper right, as one might expect?

Another thought - instead of introducing this as a new Zoom mode, why not replace the current zoom with the closer zoom? It would avoid having to explain to people “well, Zoom To Data doesn’t zoom real close enough, so you can use the other Zoom Close To Data button that does”. I think this is more of a fix for Zoom To Data than it is a new feature.

2 Likes

The right side of the cylinder is in the center because the focal point stays at the center of the bounding box. We just compute the distance to make the closest side of the bounding box visible

I don’t know if we can replace the current zoom, because actually if the user move around the object after “Zoom To Data”, he can be sure that the data will be always visible. In case of a “Zoom Close To Data”, the object can go out of the scene when moving the camera

1 Like

I think the result is as surprising as what Zoom To Data does currently, just in a different way, but indeed the zoom is closer.

Have you considered using a screen-space bounding box to determine the zoom and pan? Seems like that would work better and be more intuitive than fitting the closest face of the bounding box.

Do we make the claim somewhere that “Zoom To Data” guarantees that the data is always regardless of rotation? I don’t think so. I think people just want to fill the screen with data when “Zoom To Data” is clicked, and your new approach gets closer to that goal.

Do we make the claim somewhere that “Zoom To Data” guarantees that the data is always regardless of rotation? I don’t think so. I think people just want to fill the screen with data when “Zoom To Data” is clicked, and your new approach gets closer to that goal.

No, but a user could rely on this behavior.

Fair enough. I just want to make sure yet another zoom button is required.

Thanks to Cory for helping me understand the issue.

Question: What is the difference between “Reset” and “Zoom to Data”? It appears to me that they do the same thing. I NEVER use Zoom to Data, again, because I don’t know what it does.

“Reset” resets the camera so the bounding box of ALL objects in the view fill the screen. “Zoom to Data” resets the camera so that the bounding box of the ACTIVE source in the pipeline fills the screen.

OK, now that makes sense. In my mind, the “Zoom to Data” resets the camera to the bounding box of the ACTIVE Filter/Source/Reader (I know, Source is overloaded in the discussion above).

After rewriting this three times, I want to ponder further.

So we will go forward with adding a new button, ideally with the implementation suggested by @cory.quammen.

I am undecided with regards to this new button. The reason is that I believe this functionality is missing in ParaView, but it is very rarely needed. Furthermore, the solution is trivial - you click Reset, and zoom out. Do we really want Yet Another Icon for something that is not (frequently) needed?

We have users asking for it.

Is it acceptable to have a single button and control the behavior in the settings ?
Or maybe change the behavior when a modifier (ctrl / alt /shift / …) is pressed ?

A modifier for a tool button is unheard of in ParaView.

A setting would be ok, even if it hides the feature to potential users.

The “Capture Screenshot to the clipboard” toolbutton saves to a file if Ctrl is pressed instead of copying to the clipboard, so there is precedent.

I really don’t like this idea. It hides the zoom mode, and makes Python tracing of a zoom that much harder.

I’d vote to just add new tool buttons. However you implement the new mode, you may want to do it for both the whole scene bounding box and have another button to do it for the active source.

The “Capture Screenshot to the clipboard” toolbutton saves to a file if Ctrl is pressed instead of copying to the clipboard, so there is precedent.

Right ! Forgot this one.

OK, if users are asking for it, I agree we should implement it. I also would rather we have a second (or in this case third) button rather than overloading one button. Overloading buttons is confusing.

OK so if you are all agree with this idea, we go for two new buttons (one to zoom on active data and one to zoom on all bounds), as this is a new functionality and can be asked by some users.

Considering the implementation, I thought to do, from Cory’s idea :

• Still set the focal point as the center of the bounding box (not quite sure here, we could maybe use as focal point the center of the screen space bounding bounding box, with a Z equals to maxZ - minZ / 2.0)
• Project all the bounding box points in screen space, get the two min/max points
• Reproject these 2 points in world space, using for the Z coordinate the minimum z of the bbox in world space
• Adjust camera distance so that these 2 points lie in the camera field of view
1 Like

That sounds reasonable at first reading.