Matlab App: Get cursor position in axis continuously, keep plot interactivity
Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this?Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this? Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this? appdesigner, app designer, windowbuttonmotionfcn, axes, matlab gui MATLAB Answers — New Questions