/usr/share/psychtoolbox-3/PsychOneliners/Ellipse.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
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 | function bool = Ellipse(a,b,horpow,verpow)
% Ellipse(a) creates a Circle with
% diameter == ceil(2*a)
%
% Ellipse(a,b) creates an Ellipse with
% horizontal axis == ceil(2*a) and vertical axis == ceil(2*b)
%
% Ellipse(a,b,power) generates a superEllipse according to the
% geometric formula (x./a).^power + (y./b).^power < 1
%
% Ellipse(a,b,horpow,verpow) generates a generalized superEllipse according
% to the geometric formula(x./a).^horpow + (y./b).^verpow < 1
%
% For more info on superEllipses, see
% http://en.wikipedia.org/wiki/SuperEllipse
%
% Ellipse returns a (tighly-fitting) boolean matrix which is true for all
% points on the surface of the Ellipse and false elsewhere
% DN 2008
% DN 2009-02-02 Updated to do Circles and input argument handling more
% efficiently
% DN 2011-08-31 Output wasn't always of right size (ceil(2*input))
error(nargchk(1, 4, nargin, 'struct'));
if nargin < 2
b = a;
end
if nargin < 3
horpow = 2;
end
if nargin < 4
verpow = horpow;
end
[x,y] = meshgrid(linspace(-a,a,ceil(2*a)+2),linspace(-b,b,ceil(2*b)+2));
bool = abs(x./a).^horpow + abs(y./b).^verpow < 1;
% return in a tight-fitting matrix
cropcoords = CropBlackEdges(bool);
bool = bool(cropcoords(3):cropcoords(4),cropcoords(1):cropcoords(2));
|