sofgca

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 4.5, Creation date: 2019-03-24, Last change: 2025-08-18

returns the pixel resolution of gca

Description

this function is helpful if interactive functions select points near a line, point or polygon and the figure / axis resultion must be taken into account to select the items
it is not the same as:
sofBB(axis) % return the maximum coordinate length in gca

See Also: sofBB

Example Illustration

 missing image of sofgca

Syntax

[s,ss]=sofgca

Output Parameter

s: largest inaccuracy
ss: inaccuracy (pixel size in units)

Examples


figure; sofgca
figure; axis([-1000 1000 -1000 1000]); sofgca, sofBB(axis)




Copyright 2019-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, sofgca, is designed to determine the pixel resolution of the current axes in a MATLAB figure. It is particularly useful when interactive functions need to select points near a line, point, or polygon, and the figure or axis resolution must be considered to accurately select items.

Input Parameters

The function sofgca does not take any input parameters.

Output Results

Algorithm Steps

  1. Call the function getgcapixelsize to retrieve the pixel size of the current axes. This function returns a vector a where a(3) and a(4) represent the pixel dimensions in the x and y directions, respectively.
  2. Use the axis function to get the current axis limits, stored in vector b. The vector b contains the limits in the form [xmin xmax ymin ymax].
  3. Calculate the inaccuracy ss as a two-element vector:
    • ss(1) = (b(2) - b(1)) / a(3): This represents the pixel size in units for the x-direction.
    • ss(2) = (b(4) - b(3)) / a(4): This represents the pixel size in units for the y-direction.
  4. Determine the largest inaccuracy s by taking the maximum value of the ss vector using the max function.

Example Usage

To use the function, simply call it in a MATLAB script or command window. For example:

figure; sofgca
figure; axis([-1000 1000 -1000 1000]); sofgca, sofBB(axis)

This will display the pixel resolution of the current axes and can be used in conjunction with other functions like sofBB to further analyze the axis properties.

Algorithm explaination created using ChatGPT on 2025-08-18 23:04. (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