开发者

How to find the border points of a particular shape

开发者 https://www.devze.com 2023-02-09 08:37 出处:网络
Suppose I have a irregular, random, shape generated from a dataset. How do I find points that are situated on the shape\'s border?

Suppose I have a irregular, random, shape generated from a dataset. How do I find points that are situated on the shape's border?

I am using R. Are there any packages in R for this purpose? For simplicity, just assume that I have a 2d dataset开发者_JS百科 of points.


You are looking for the chull() function to compute the convex hull of a 2D object, in package grdevices.

Here is the example from the online help:

require(stats)
X <- matrix(rnorm(2000), ncol = 2)
chull(X)
## Not run: 
# Example usage from graphics package
plot(X, cex = 0.5)
hpts <- chull(X)
hpts <- c(hpts, hpts[1])
lines(X[hpts, ])

How to find the border points of a particular shape


These functions (packages) seem adequate:

  • ahull (alphahull)
  • convex.hull (tripack)
  • chull (grDevices)
  • in.chull (sgeostat)
  • convhulln (geometry)
  • convexhull.xy (spatstat)
  • calcConvexHull (PBSmapping)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号