← 返回首页
closes #545 by clewis7 · Pull Request #900 · fastplotlib/fastplotlib · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

closes #545#900

Draft
clewis7 wants to merge 2 commits into
mainfrom
ball-marker
Draft

closes #545#900
clewis7 wants to merge 2 commits into
mainfrom
ball-marker

Conversation

clewis7 commented Sep 19, 2025
edited
Loading

Copy link
Copy Markdown
Member

Started working on ball selector

TODO:

  • get 3D lines working
  • add example with PCA
  • add exaple syncing in time with something else

clewis7 commented Sep 19, 2025

Copy link
Copy Markdown
Member Author

@kushalkolar
Two things:

  1. Input on how I am updating the position of the selector. Right now, I am just using a distance measure to find the nearest point on the line. There might be a better alternative if you have any thoughts.
  2. When I try to add a ball marker to a 3D line, adding seems to be fine, but the movement is weird. I think maybe it has to do with mapping from screen to world space. The z is always going to be zero by default. Then, when I try to move along the 3d line, I get nans in the position of x and y (which seems strange to me). The 2D case seems to work fine, and I think it is because the z-column is always zero.

Copy link
Copy Markdown
Member
1. Input on how I am updating the position of the selector. Right now, I am just using a distance measure to find the nearest point on the line. There might be a better alternative if you have any thoughts.

I think it LGTM, technically distance requires sqrt but we just need argmin and sqrt is monotonic so it doesn't matter.

2. When I try to add a ball marker to a 3D line, adding seems to be fine, but the movement is weird. I think maybe it has to do with mapping from screen to world space. The z is always going to be zero by default. Then, when I try to move along the 3d line, I get `nans` in the position of x and y (which seems strange to me). The 2D case seems to work fine, and I think it is because the z-column is always zero.

I think you could get a guess of the z position of the closest line point by raycasting, I think you should be able to use the Camera to figure out the ray vector that corresponds to the given screen pixel @almarklein ?

Copy link
Copy Markdown
Collaborator

Are you interested in the vector, in world space, that points down the screen (in z)?

In that case you could do something like:

ndc = la.vec_transform(world_pos, camera.camera_matrix) ndc1 = np.array([*ndc[:3], ndc[3]+0.01]) ndc2 = np.array([*ndc[:3], ndc[3]-0.01]) inverse_projection = la.mat_inverse(camera.camera_matrix) world1 = la.vec_transform(ndc1, inverse_projection) world2 = la.vec_transform(ndc2, inverse_projection) vec = world2 - world1

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants

Footer

© 2026 GitHub, Inc.