Search code examples
matlabcursor-position

Matlab Axes Current Point does not work as it is supposed to


I am using mesh to plot a 2D color surface on a 3-D axes. Then I need to move this surface dragging with the mouse. My problem is get(ax,'CurrentPoint') gives me same values for two different points closeby. If click on a further point it gives another result which is also same for nearby points of that. I could not figure out why this is happening.

             :
             :
hSurface = mesh(ax, XI,YI, flipud(ZI), qz,...
                 'FaceColor','interp',...
                 'EdgeColor','none','FaceLighting','phong','FaceAlpha',0.6);  
set(hSurface,'buttonDownFcn',@move) 

function move(src,ev)
         :
         :
      initpt = get(ax,'CurrentPoint')
         :
         :
 end

Solution

  • Solved. The projection type causing this problem. Previously it was set to camproj(ax,'perspective'), I set it to orthographic and the problem is solved.