langle.m
来自「matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译」· M 代码 · 共 33 行
M
33 行
function alfa=langle(x,y)%LANGLE Determines angles of a line.%% LANGLE(X,Y) return the angles of the line% described by X and Y.%% Claudio 16 Oct. 1995.%%% Copyright (c) 1995 by Claudio Rivetti and Mark Young% claudio@alice.uoregon.edu, mark@alice.uoregon.edu%n=length(x);ang=[];if n ~= length(y) error('Vectors must be the same lengths.')endfor i=2:n-1 AB=(x(i)-x(i-1))^2 + (y(i)-y(i-1))^2; BC=(x(i+1)-x(i))^2 + (y(i+1)-y(i))^2; AC=(x(i+1)-x(i-1))^2 + (y(i+1)-y(i-1))^2; cosalfa=(AB+BC-AC)/(2*sqrt(AB*BC)); alfa=[alfa;acos(cosalfa)*180/pi];endreturn;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?