Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lookat-translating zoom mode for Camera3D #3793

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Apr 17, 2024

Description

Fixes #3792

Adds a mode which translates lookat rather than eyeposition, avoiding the camera getting moved inside a shape. To avoid the center of rotation changing the pr adds a static_lookat. It is used as the center of rotation and ignores translations done by zooming. The resulting behavior depends on other settings:

  • With cad = true the cameras lookat is held on the connecting line between eyeposition and static_lookat. This should lead to different rotation speeds when zooming but nothing jarring.
  • With cad = false, zoom_shift_lookat = true (default) lookat and eyeposition get translated, leading to rotations no longer being centered at the screen center. This becomes more messy when translating the camera, as that translates static_lookat too, i.e. it keeps the pivoted rotation.
  • With both false, we have neither a rotating nor translating effect when zooming and everything is fine
  • With zoom_target = :lookat things should continue to work as they did before

Type of change

  • New feature (non-breaking change which adds functionality)

needs some more testing to be sure it's not breaking...

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@MakieBot
Copy link
Collaborator

MakieBot commented Apr 17, 2024

Compile Times benchmark

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running:

using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
using create display create display
GLMakie 3.49s (3.44, 3.54) 0.04+- 172.12ms (169.84, 174.71) 2.02+- 481.35ms (475.66, 485.98) 3.63+- 7.68ms (7.56, 7.78) 0.09+- 26.19ms (26.08, 26.37) 0.11+-
master 3.48s (3.45, 3.54) 0.04+- 173.72ms (168.15, 181.28) 4.31+- 489.31ms (477.16, 511.15) 11.13+- 7.67ms (7.55, 7.74) 0.07+- 26.10ms (25.94, 26.22) 0.09+-
evaluation 1.00x invariant, 0.01s (0.23d, 0.67p, 0.04std) 1.01x invariant, -1.59ms (-0.47d, 0.40p, 3.17std) 1.02x invariant, -7.96ms (-0.96d, 0.11p, 7.38std) 1.00x invariant, 0.01ms (0.15d, 0.78p, 0.08std) 1.00x invariant, 0.08ms (0.83d, 0.15p, 0.10std)
CairoMakie 3.08s (2.96, 3.23) 0.12+- 173.57ms (162.94, 193.31) 12.80+- 104.99ms (98.37, 112.58) 5.78+- 7.48ms (7.11, 8.04) 0.37+- 892.36μs (876.05, 904.36) 11.22+-
master 3.03s (2.94, 3.12) 0.07+- 165.70ms (161.90, 170.29) 2.66+- 101.52ms (98.67, 105.46) 2.44+- 7.23ms (7.11, 7.65) 0.19+- 882.64μs (876.90, 887.12) 3.34+-
evaluation 0.98x invariant, 0.05s (0.54d, 0.34p, 0.09std) 0.95x invariant, 7.87ms (0.85d, 0.16p, 7.73std) 0.97x invariant, 3.46ms (0.78d, 0.18p, 4.11std) 0.97x invariant, 0.24ms (0.83d, 0.16p, 0.28std) 0.99x invariant, 9.71μs (1.17d, 0.06p, 7.28std)
WGLMakie 3.79s (3.70, 3.88) 0.07+- 399.93ms (387.96, 413.66) 10.40+- 8.95s (8.79, 9.18) 0.15+- 9.98ms (9.43, 11.77) 0.81+- 69.51ms (68.88, 71.45) 0.89+-
master 3.75s (3.68, 3.80) 0.05+- 391.93ms (382.08, 399.60) 6.83+- 8.94s (8.72, 9.10) 0.13+- 9.67ms (9.35, 9.91) 0.21+- 69.74ms (68.94, 71.25) 0.75+-
evaluation 0.99x invariant, 0.03s (0.52d, 0.35p, 0.06std) 0.98x invariant, 7.99ms (0.91d, 0.12p, 8.62std) 1.00x invariant, 0.01s (0.07d, 0.90p, 0.14std) 0.97x invariant, 0.31ms (0.53d, 0.36p, 0.51std) 1.00x invariant, -0.23ms (-0.28d, 0.61p, 0.82std)

@ffreyer ffreyer marked this pull request as ready for review April 22, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid clipping on 3D zoom to be able to inspect meshes up close
3 participants