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

Allow GLMakie to display surfaces transformed by a 3d transform func #4243

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

Conversation

asinghvi17
Copy link
Member

@asinghvi17 asinghvi17 commented Aug 26, 2024

Description

Fixes #2890

Modifies GLMakie to be able to use 2D to 3D transformations in surface.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Added an entry in CHANGELOG.md (for new features and breaking changes)
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@asinghvi17 asinghvi17 marked this pull request as draft August 26, 2024 05:07
@MakieBot
Copy link
Collaborator

MakieBot commented Aug 26, 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 6.57s (6.51, 6.66) 0.06+- 173.88ms (165.96, 182.95) 5.43+- 527.81ms (497.10, 560.01) 25.90+- 8.39ms (8.15, 8.64) 0.17+- 26.54ms (26.39, 26.83) 0.14+-
master 6.55s (6.45, 6.66) 0.09+- 170.88ms (167.56, 179.29) 4.60+- 512.40ms (483.53, 558.75) 28.63+- 8.61ms (8.15, 9.07) 0.33+- 26.59ms (26.45, 26.85) 0.15+-
evaluation 1.00x invariant, 0.02s (0.30d, 0.58p, 0.07std) 0.98x invariant, 3.0ms (0.60d, 0.29p, 5.01std) 0.97x invariant, 15.41ms (0.56d, 0.31p, 27.27std) 1.03x invariant, -0.22ms (-0.84d, 0.15p, 0.25std) 1.00x invariant, -0.06ms (-0.38d, 0.49p, 0.15std)
CairoMakie 6.20s (6.10, 6.38) 0.11+- 168.22ms (163.70, 182.36) 6.33+- 202.44ms (197.41, 204.65) 2.78+- 8.19ms (7.93, 8.41) 0.19+- 1.22ms (1.21, 1.22) 0.00+-
master 6.21s (6.16, 6.24) 0.03+- 171.25ms (167.09, 176.82) 3.82+- 205.55ms (199.64, 211.61) 4.68+- 8.07ms (7.93, 8.39) 0.15+- 1.21ms (1.20, 1.23) 0.01+-
evaluation 1.00x invariant, -0.01s (-0.11d, 0.85p, 0.07std) 1.02x invariant, -3.02ms (-0.58d, 0.30p, 5.07std) 1.02x invariant, -3.1ms (-0.81d, 0.16p, 3.73std) 0.99x invariant, 0.12ms (0.70d, 0.22p, 0.17std) 1.00x invariant, 0.0ms (0.11d, 0.84p, 0.01std)
WGLMakie 6.31s (6.27, 6.38) 0.04+- 161.25ms (159.16, 163.89) 1.89+- 5.70s (5.63, 5.80) 0.05+- 12.27ms (12.04, 12.95) 0.31+- 130.92ms (122.81, 135.53) 4.10+-
master 6.29s (6.26, 6.30) 0.01+- 158.79ms (156.81, 160.92) 1.64+- 5.98s (5.96, 6.01) 0.02+- 12.03ms (11.84, 12.23) 0.13+- 132.83ms (125.68, 144.93) 6.80+-
evaluation 1.00x invariant, 0.02s (0.71d, 0.22p, 0.02std) 0.98x slower X, 2.45ms (1.39d, 0.02p, 1.76std) 1.05x faster ✓, -0.28s (-6.89d, 0.00p, 0.04std) 0.98x invariant, 0.24ms (1.03d, 0.09p, 0.22std) 1.01x invariant, -1.91ms (-0.34d, 0.54p, 5.45std)

@asinghvi17 asinghvi17 changed the title [WIP] Allow GLMakie to display surfaces transformed by a 3d transform func Allow GLMakie to display surfaces transformed by a 3d transform func Sep 3, 2024
@asinghvi17 asinghvi17 marked this pull request as ready for review September 3, 2024 03:40
@asinghvi17
Copy link
Member Author

Bump @SimonDanisch, could this be reviewed? Thanks :D

Comment on lines 827 to +828
matrix = if x isa AbstractMatrix && y isa AbstractMatrix
Makie.f32_convert(f32c, apply_transform.((t,), Point.(x, y), space), space)
[Makie.f32_convert(f32c, apply_transform(t, Point3(x, y, z[ix, iy]), space), space) for (ix, x) in pairs(x), (iy, y) in pairs(y)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this calling z[CartesianIndex(...), CartesianIndex(...)]?

Copy link
Collaborator

@ffreyer ffreyer Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably also extend the refimg test to test

vec-vec vec-mat
mat-vec mat-mat

inputs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, and will test that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably also be a loop operating on a pre-allocated array - that would be much clearer I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready to review
Development

Successfully merging this pull request may close these issues.

GLMakie doesn't correctly use 2D to 3D transforms with the surface recipe
3 participants