Using drawpoint in 3d axes
Mostra commenti meno recenti
Hello,
I have a program that plots the electrostatic potential created by n electrons confined to a sphere. What I'd like to be able to do is grab one of those electrons and move it in the figure to see how the potential changes. What I've been able to do is project everything from the surface of the sphere onto 2D axes and use drawpoint to get the interactivity I want. However, I'm a little annoyed by the distortions inherent in the projection so before I go and add a bunch of other functionality I have in mind I want to see if I can get the interactivity while having everything remain on the sphere.
One strange thing is that while drawpoint will still create a Point object in 3D axes (constrained to z=0), it's motion is distorted: upon clicking the point, it jumps away and will move as if constrained to a line parallel to the x- or y-axes. Once the cursor gets far enough away, however, its motion does follow the cursor, just with a constant offset. The magnitude of that offset is a function of the viewing angle: when looking straight down or up the point moves as expected, but a low angle makes the point get very confused.
The fact that the point is always on the xy-plane isn't necessarily a deal-breaker, though I can already think of several issues. The bigger issue is of course the strange distorted motion. I assume there's nothing I can really do to fix that, so my question is whether there might be a different way to achieve the same end - some sort of callback on a scatterplot that would update the coordinates based on the mouse position?
If not, I do have an idea for a compromise, but I figured this was interesting enough to ask.
Thanks!
1 Commento
I don't find that it is constrained to z=0, but rather that it will be projected onto any one of the edge planes or mid-planes of the axis box, depending on where the pointer is positioned. I don't know if there is any documentation about this rule, but it has to map to some 2D sub-region of the axis, because an image.roi.point object only has 2 position coordinates.
Risposta accettata
Più risposte (1)
Another approach is to make a custom app, with controls for the position of the electron.

Categorie
Scopri di più su Lighting, Transparency, and Shading in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!