[s,ss]=sofgca
s : | largest inaccuracy | |
ss : | inaccuracy (pixel size in units) |
figure; sofgca
figure; axis([-1000 1000 -1000 1000]); sofgca, sofBB(axis)
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.
The function sofgca
does not take any input parameters.
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.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].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.s
by taking the maximum value of the ss
vector using the max
function.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.