Matlab:查找由点(x,y)包围的区域 [英] Matlab: Find area enclosed by points (x,y)
本文介绍了Matlab:查找由点(x,y)包围的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有8个点在二维空间中创建了一个八边形多边形的轮廓.我需要找到这些点周围的区域,但是如何使用matlab做到这一点呢?
I've got 8 points that create the outline of an eight-sided polygon in two-dimensional space. I need to find the area enclosed be these points, but how do I do that using matlab?
八个点(x,y)包含在8x2矩阵B中.
The eight points (x,y) are contained in the 8x2 matrix B.
B = [ 260 455;
1187 467;
1325 605;
1342 1533;
1207 1675
251 1690;
107 1547;
116 593];
通过绘制从第1行到第2行的点,然后从第2行到第3行的点的直线来创建多边形,依此类推...
The polygon is created by drawing straight lines from the point which is row 1 to row 2, then row 2 to row 3 and so on...
推荐答案
您可以使用 polyarea
:
You can use polyarea
:
ar = polyarea(B(:, 1), B(:, 2));
这篇关于Matlab:查找由点(x,y)包围的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文