insidepolygon.m
来自「本代码为基于matlab的求解偏微分方程的利用径向基函数的无网格方法的源码」· M 代码 · 共 18 行
M
18 行
function points=insidepolygon(h,vertex)
% generate regular interior data points
% for a boundary which is defined by a closed polygonal curve
% determined by the vertices "vertex"
% h is the filldistance
n=ceil(sqrt(2)/h)% with approximate fill distance h
dh=2/n;
[X,Y]=meshgrid(-1:dh:1,-1:dh:1);
[nx,ny]=size(X);
xr=reshape(X,[(nx)*(nx) 1]);
yr=reshape(Y,[(nx)*(nx) 1]);
in=inpolygon(xr,yr,vertex(:,1),vertex(:,2));
I=find(in==1);
points=[xr(I) yr(I)];
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?