allen-cell-animated / agave

Other
35 stars 6 forks source link

Feature/view toolbar #192

Closed toloudis closed 5 months ago

toloudis commented 5 months ago

Expected review time: medium, maybe 20 min?

This pull request creates a toolbar closely tied to the AGAVE viewport. The toolbar contains controls for the following functionality:

Home: reorient camera to its default position, centering the volume in the view and looking down the -Z axis. Replaces the former "Reset" button. Frame View: fit the volume with its current camera rotation angle back to the center of the view. This effectively undoes any zooming and panning but retains any rotations. Toggle perspective/orthographic projection: the button icon will switch to indicate that the state has changed. Replaces the former "Persp/Ortho" button. Top,Bottom,Left,Right,Front,Back buttons: will align camera to +Z,-Z,+X,-Z,+Y,-Y axes to get quick perfectly aligned side views.

Before:

AGAVE 1 6 4 2024-05-31 17-01-38

After:

AGAVE 1 6 4 2024-05-31 16-59-50

This is sort of a functional "draft" design and will receive further iteration on icon design and arrangement of the buttons.

The biggest interesting code change here is the implementation of "Frame View". I wanted to get the oriented bounding box to fit tightly to the view and it turns out you have to do some semi-complicated 3d math to get it to fit nicely. This is all in CalculateCameraPosition in CCamera.cpp.

There is some extra code to add Qt support for svg icons.

toloudis commented 5 months ago

@TravisKroeker fyi can take a look at my screenshots when you are ready. I'll get you a build where you can touch all the buttons and see what they do.

toloudis commented 5 months ago

Have some questions and am still in the process of trying to troubleshoot my local build. (Also the 20 minute estimate is really funny to me, I spent at least an hour looking through code lol)

Sorry about the estimate - I didn't really know. Most of the code isn't doing a whole lot, except for the 3d math function.

toloudis commented 5 months ago

One iteration on updating icons:

agave_vwP6H7XTN5