我正在尝试在R中获得点特征的凸包。
var edgeGeometry = new THREE.EdgesGeometry(meshes[meshIndex]); // or WireframeGeometry
var edgeMaterial = new THREE.LineBasicMaterial({ color: 0x00000, linewidth: 2 });
var wireframe = new THREE.LineSegments(edgeGeometry, edgeMaterial);
var object = new THREE.Mesh(meshes[meshIndex], material);
object.add(wireframe);
我希望library(tmap)
library(sf)
nc <- st_centroid(st_read(system.file("shape/nc.shp", package="sf")))
qtm(nc)
ch <- st_convex_hull(nc)
qtm(ch)
identical(nc, ch)
包含具有凸包的多边形。但是,它返回的点不相同。我该如何获取多边形呢?
答案 0 :(得分:8)
您需要将点合并到MULTIPOINTS
library(tmap)
library(sf)
nc <- st_centroid(st_read(system.file("shape/nc.shp", package="sf")))
qtm(nc)
ch <- st_convex_hull(st_union(nc))
qtm(ch)