Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Reference spaces #809

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Reference spaces #809

wants to merge 4 commits into from

Conversation

kushalkolar
Copy link
Member

@kushalkolar kushalkolar commented May 2, 2025

Proof of concept for reference spaces, implements ideas from #772

I think I want to rename it to reference frame since that's what physicist and math people are used to, I wanted to avoid confusion with the Frame class which is something else completely but Frame is something a user would never touch so.

There are two sine waves here but the red one is 3 orders or magnitude larger. The magenta y-axis indicates the values for the red sine data which ranges from [-1000, 1000] and the white axis ticks are for the white sine line which ranges from [-1, 1]

rs-2025-05-01_23.37.11.mp4

By removing the camera from a reference space's controller we can also interactively independently rescale a given reference frame! Will need quite some work to do this properly, have methods to re-sync positions or other things between reference frames etc.

import numpy as np
import fastplotlib as fpl


xs = np.linspace(0, 10 * np.pi, 1000)
ys = np.sin(xs)

ys100 = ys * 1000

l1 = np.column_stack([xs, ys])
l2 = np.column_stack([xs, ys100])

fig = fpl.Figure(size=(500, 400))

fig[0, 0].add_line(l1)
fig.show(maintain_aspect=False)
fig[0, 0].auto_scale(zoom=0.4)

rs = fig[0, 0].add_reference_space(scale=(1, 500, 1))
l2 = fig[0, 0].add_line(l2, reference_space=rs, colors="r")
l2.add_axes(rs)
l2.axes.y.line.material.color = "m"

fpl.loop.run()

@kushalkolar kushalkolar requested a review from clewis7 as a code owner May 2, 2025 03:33
@kushalkolar kushalkolar marked this pull request as draft May 2, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant