在二维中确定给定区域边界中的点的好方法是什么?
假设给您一个嵌套列表,其中包含两个坐标的列表,例如
{ {x1,y1}, {x2,y2}, {x3,y3} }
当然,实际的嵌套列表将有比 3 更多的点,这些点与平面中的给定区域相关联。例如,嵌套列表可以确定平面中的磁盘。那么,输出应该是一个与圆对应的嵌套列表。
我不希望将任何图像识别内容应用于可能的情节。我想对嵌套列表进行操作。
在二维中确定给定区域边界中的点的好方法是什么?
假设给您一个嵌套列表,其中包含两个坐标的列表,例如
{ {x1,y1}, {x2,y2}, {x3,y3} }
当然,实际的嵌套列表将有比 3 更多的点,这些点与平面中的给定区域相关联。例如,嵌套列表可以确定平面中的磁盘。那么,输出应该是一个与圆对应的嵌套列表。
我不希望将任何图像识别内容应用于可能的情节。我想对嵌套列表进行操作。
This answer is based on @andand comment. The credit is all his.
If I have a nested list called "region", with lists of the 2d coordinates, I would get the "convex hull" of it writing
Needs["ComputationalGeometry`"]
regionhull = ConvexHull[ region ]
But "ConvexHull" gives us the indices of the lists within the nested list, in counterclockwise order, corresponding to the convex boundary of the region. Thus, an adittional step is needed, to make the needed output:
regionboundary = region[[ regionhull ]]
But still, this answer is incomplete. It seems to me that a "concave hull" algorithm would be the more general solution. Would anyone know anything about the concave hull in Mathematica? I may post an additional question for that.
Below, I show a figure to understand the concave and convex hull algorithms extracted from
A tutorial for the "Computational Geometry Package" is found at
http://reference.wolfram.com/mathematica/ComputationalGeometry/tutorial/ComputationalGeometry.html
** Addendum **
The package "alphahull" can solve the problem of finding the boundary of a concave region. Its description is found here:
http://cran.r-project.org/web/packages/alphahull/vignettes/alphahull.pdf
听起来你想要某种插值技术。http://en.wikipedia.org/wiki/Interpolation