/usr/share/freemat/toolbox/graph/point.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | % POINT POINT Get Axis Position From Mouse Click
%
% Usage
%
% Returns information about the currently displayed image based on a use
% supplied mouse-click. The general syntax for its use is
%
% t = point
%
% The returned vector y has two elements:
% where x,y are the coordinates in the current axes of the click. This
% function has changed since FreeMat 1.10. If the click is not inside the
% active area of any set of axes, a pair of NaNs are returned.
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function t = point
p = hpoint;
% Convert p to a fractional coordinate
s = get(gcf,'figsize'); s = s(:);
p = p(:)./s(:);
p(2) = 1-p(2);
% Get the list ofchildren
children = get(gcf,'children');
% Check us agains each child
for i=1:numel(children)
position = get(children(i),'position');
if (hitTest(position,p))
xlims = get(children(i),'xlim');
ylims = get(children(i),'ylim');
tpos(1) = xlims(1) + (p(1)-position(1))/position(3)*(xlims(2)-xlims(1));
tpos(2) = ylims(1) + (p(2)-position(2))/position(4)*(ylims(2)-ylims(1));
t = tpos;
return;
end
end
t = [nan,nan];
function b = hitTest(rect,p)
if ((p(1) >= rect(1)) && (p(1) <= (rect(1)+rect(3))) && (p(2) >= rect(2)) && (p(2) <= (rect(2)+rect(4))))
b = 1;
else
b = 0;
end
|