📄 outconvex2d.m
字号:
function out = outconvex2d(x,p)%function out = outconvex2d(x,p)%Test if each of the x points are inside the convex polygon p,%and return the number of inequalities failed by each point.%p is a 2xn counter-clockwise list of vertices,%with the first vertex duplicated.n = size(p,2);% form A,B such that internal points satisfy Ax <= BA = [ p(2,2:n) - p(2,1:n-1); p(1,1:n-1) - p(1,2:n)]';B = zeros(n-1,1);for i=1:n-1 B(i) = A(i,:)*p(:,i);endout = sum( A*x > B(:,ones(1,size(x,2))) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -