Syntax
h=SGWindowButtonMotionFcn(srch,cbdat)
Input Parameter
Output Parameter
h : | | global variable get_gca_CurrentPoint |
Examples
set(gcf,'WindowButtonMotionFcn',@SGWindowButtonMotionFcn);
Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, SGWindowButtonMotionFcn
, is designed to address a change in behavior observed in MATLAB 2019a regarding the get(gca,'CurrentPoint')
function. The function is part of the SolidGeometry library and is used to track the current point in a graphical user interface, even when 3D rotation is enabled.
Input Parameters
- srch: This parameter is not used within the function, but it is typically required for callback functions in MATLAB.
- cbdat: Similar to
srch
, this parameter is not utilized in the function but is part of the standard callback signature.
Output Results
- h: The function does not explicitly return a value, but it updates two global variables:
- get_gca_CurrentPoint2D: A global variable storing the 2D coordinates of the current point.
- get_gca_CurrentPoint: A global variable storing the full 3D coordinates of the current point.
Function Workflow
- The function begins by declaring two global variables:
get_gca_CurrentPoint2D
and get_gca_CurrentPoint
.
- It retrieves the current point from the current axes using
get(gca,'CurrentPoint')
, which returns a 2x3 matrix representing the 3D coordinates of the point.
- The first row of this matrix, which contains the 2D coordinates, is assigned to
get_gca_CurrentPoint2D
.
- The entire matrix is assigned to
get_gca_CurrentPoint
, capturing the full 3D coordinates.
This function is typically set as a callback for the WindowButtonMotionFcn
property of a figure, allowing it to update the global variables whenever the mouse is moved within the figure window. This ensures that the current point is accurately tracked, even when 3D rotation is enabled.
Algorithm explaination created using ChatGPT on 2025-08-19 06:56. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21