currentpoint in axes and figure matlab

Axes CurrentPoint

2-by-3 matrix

Location of last button click, in axes data units.Contains the coordinates of two points defined by the location ofthe pointer at the last mouse click. MATLAB returns the coordinateswith respect to the requested axes.

Clicking Within the Axes — OrthogonalProjection

The two points lie on the line that is perpendicular to theplane of the screen and passes through the pointer. This is true forboth 2-D and 3-D views.

The 3-D coordinates are the points, in the axes coordinate system,where this line intersects the front and back surfaces of the axesvolume (which is defined by the axesx,y,and z limits).

The returned matrix is of the form:

where front defines the point nearestto the camera position. Therefore, if theCurrentPoint propertyreturns thecp matrix , then the first row,

cp(1,:)

specifies the point nearest the viewer and the second row,

cp(2,:)

specifies the point furthest from the viewer.

Clicking Outside the Axes — OrthogonalProjection

When you click outside the axes volume, but within the figure,the returned values are:

  • Back point — a point in the plane of the cameratarget (which is perpendicular to the viewing axis).

  • Front point — a point in the camera positionplane (which is perpendicular to the viewing axis).

These points lie on a line that passes through the pointer andis perpendicular to the camera target and camera position planes.

Clicking Within the Axes — PerspectiveProjection

The values of the current point when using perspective projectcan be different from the same point in orthographic projection becausethe shape of the axes volume can be different.

Clicking Outside the Axes — PerspectiveProjection

Clicking outside of the axes volume returns the front pointas the current camera position at all times. Only the back point updateswith the coordinates of a point that lies on a line extending fromthe camera position through the pointer and intersecting the cameratarget at the point.

Figure CurrentPoint

two-element vector: [x-coordinate, y-coordinate]

Location of last button click in this figure. MATLAB setsthis property to the location of the pointer at the time of the mostrecent mouse button press. MATLAB updates this property wheneveryou press the mouse button while the pointer is in the figure window.

Note that if you select a point in the figure and then use thevalues returned by theCurrentPoint propertyto plot that point, there can be differences in the position due toround-off errors.

CurrentPoint and Cursor Motion

In addition to the behavior described above, MATLAB updates CurrentPoint beforeexecuting callback routines defined for the figureWindowButtonMotionFcn and WindowButtonUpFcn properties.This enables you to query CurrentPoint from thesecallback routines. It behaves like this:

  • If there is no callback routine defined for the WindowButtonMotionFcn ortheWindowButtonUpFcn, then MATLAB updatestheCurrentPoint only when the mouse button ispressed down within the figure window.

  • If there is a callback routine defined for the WindowButtonMotionFcn,then MATLAB updates theCurrentPoint justbefore executing the callback. Note that theWindowButtonMotionFcn executesonly within the figure window unless the mouse button is pressed downwithin the window and then held down while the pointer is moved aroundthe screen. In this case, the routine executes (and theCurrentPoint isupdated) anywhere on the screen until the mouse button is released.

  • If there is a callback routine defined for the WindowButtonUpFcn, MATLAB updatestheCurrentPoint just before executing the callback.Note that theWindowButtonUpFcn executes onlywhile the pointer is within the figure window unless the mouse buttonis pressed down initially within the window. In this case, releasingthe button anywhere on the screen triggers callback execution, whichis preceded by an update of theCurrentPoint.

The figure CurrentPoint is updated onlywhen certain events occur, as previously described. In some situations(such as when theWindowButtonMotionFcn takesa long time to execute and the pointer is moved very rapidly), theCurrentPoint mightnot reflect the actual location of the pointer, but rather the locationat the time when theWindowButtonMotionFcn beganexecution.

The CurrentPoint is measured from the lower-leftcorner of the figure window, in units determined by theUnits property.

The root PointerLocation property containsthe location of the pointer updated synchronously with pointer movement.However, the location is measured with respect to the screen, nota figure window.


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值