matlab多边形检测_MATLAB判断一个点是否在多边形内部,比inpolygon更健壮

这篇博客介绍了作者改进的MATLAB多边形检测函数myinpolygon,该函数解决了原始inpolygon函数在判断点是否在多边形内部时存在的问题。通过Delaunay三角剖分和convexHull提升健壮性,文中还提供了测试示例展示其准确性。
摘要由CSDN通过智能技术生成

matlab中提供了判断一个点是否在多边形内部的函数inpolygon,但是这个函数存在与polyarea类似的问题,即要求定义多边形的点必须是沿着多边形连续的,而这在很多时候很难保证。采用类似的思想,我对这个函数进行了适当改造,其健壮性立见提高。

函数 myinpolygon.mfunction flag = myinpolygon(X,Y,xv,yv)

% decide if the points are inside or outside the polygon

% Input:

% X: x-coordinations of the points to be detected

% Y: y-coordinations of the points to be detected

%xv: x-coordinations of the vertex define the polygon

%yv: y-coordinations of the vertex define the polygon

% Output:

%flag=1: inside the polygon

%flag=0: outside the polygon

% Poweed by Xianbao Duan

% Email: xianbao.d@gmail.com

% Website: http://www.52souji.net/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% log:

% 2012-05-07: Complete

% 2012-05-18: Modify the comments

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值