📄 cliplin2.m
字号:
function [x,y]=cliplin2(alpha,window)
% [x,y]=cliplin2(alpha,window)
%
% CLIPLIN2 clips the line going from pixel [0,0] to pixel on
% the border of the rectangle given by the argument window.
% The direction of the line is given by the argument alpha.
% This function returns coordinates of the mentioned pixel
% on the border.
%
% See also CLIPLIN1.
%
% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 12.10.1999
% Modifications
% 24. 6.00 V. Hlavac, comments polished.
% get window`s left side, right side, bottom...
minx=window(1);
maxx=window(2);
miny=window(3);
maxy=window(4);
if alpha(1) >= 0, ax = maxx; else ax = minx; end
if alpha(2) >= 0, ay = maxy; else ay = miny; end
if alpha(2) == 0,
x = ax;
else
x = alpha(1)*ay/alpha(2);
end
if alpha(1) == 0,
y = ay;
else
y = alpha(2)*ax/alpha(1);
end
if (x^2+ay^2) <= (ax^2+y^2),
y = ay;
else
x = ax;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -