Dear all, please, I am looking to understand how the two functions ("inpolygon ()" and "boundary()") work ?

2 次查看(过去 30 天)
Dear all, Please, I have a question: I know the function "inpolygon()" give me a logical result if a data point inside or outside a polygon and "boundary()" give me the data points on the border of a shape. But how these two algorithms work ?
Please, I need to understand them.
Kind regards Ammar

回答(1 个)

KSSV
KSSV 2017-1-11
From a given point P, the code draws a straight onto the given polygon. If this line intersects even number of times then the point lies outside the polygon, if the line intersects odd number points then points lies inside the polygon. The code is based on the refer article:
For outline refer:
  2 个评论
Ammar
Ammar 2017-1-11
Dear KSSV, I would like to thank you for this answer. Please, what about the function "boundary()" how it is work ? Kind regards Ammar
KSSV
KSSV 2017-1-12
It uses convexhull I guess....you can see the inbuilt function. Type edit boundary and read the code part and documentation given out there.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Elementary Polygons 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by