Java 二维凸面的凸包算法叫什么?
我发现了一种凸包算法,它在投影到二维后对三维凸面的一组给定点进行排序。这个算法叫什么?我查了一些常用的算法:贾维斯·马奇、quickhull、陈氏、格雷厄姆扫描,但都不匹配。守则:Java 二维凸面的凸包算法叫什么?,java,algorithm,convex-hull,plane,convex,Java,Algorithm,Convex Hull,Plane,Convex,我发现了一种凸包算法,它在投影到二维后对三维凸面的一组给定点进行排序。这个算法叫什么?我查了一些常用的算法:贾维斯·马奇、quickhull、陈氏、格雷厄姆扫描,但都不匹配。守则: private void buildConvexHull() { Point3D[] projPoints = new Point3D[unorderedPoints.length]; for (int i = 0; i < unorderedPoints.length; i+
private void buildConvexHull() {
Point3D[] projPoints = new Point3D[unorderedPoints.length];
for (int i = 0; i < unorderedPoints.length; i++) {
Point p = orthoView.project(unorderedPoints[i]); //Orthogonal projection for representing three-dimensional points in two dimensions.
projPoints[i] = new Point3D(p.x, p.y, 0.0); //projected point without third dimension
}
vertices = new Point3D[1];
//determine the point with smallest x coordinate.
Point3D bottom = projPoints[0];
vertices[0] = unorderedPoints[0];
for (int i = 1; i < projPoints.length; i++) {
if (projPoints[i].x < bottom.x) { // if (projPoints[i].y < bottom.y) {
bottom = projPoints[i];
vertices[0] = unorderedPoints[i];
}
}
Point3D p = bottom;
Point3D[] v = new Point3D[1];
v[0] = p;
do {
int i = 0;
if (projPoints[0] == p) {
i = 1;
}
Point3D candidate = projPoints[i];
HalfSpace h = new HalfSpace(p, candidate);
int index = i;
for (i = i + 1; i < projPoints.length; i++) {
if (projPoints[i] != p && h.isInside(projPoints[i]) < 0) {
candidate = projPoints[i];
h = new HalfSpace(p, candidate);
index = i;
}
}
Point3D[] vnew = new Point3D[v.length + 1];
System.arraycopy(v, 0, vnew, 0, v.length);
v = vnew;
v[v.length - 1] = candidate;
Point3D[] verticesnew = new Point3D[vertices.length + 1];
System.arraycopy(vertices, 0, verticesnew, 0, vertices.length);
vertices = verticesnew;
vertices[vertices.length - 1] = unorderedPoints[index];
p = candidate;
} while (p != bottom);
}
private void buildconvxhull(){
Point3D[]projPoints=新的Point3D[unorderedPoints.length];
对于(int i=0;i
类半空间的isInside方法:
/**
* A method checking if the given point is inside the halfspace.
*
* @return 1 if it is inside, 0 if it is on the line and otherwise -1.
*/
int isInside(Point3D x) {
Point3D n = a.normal(b, x);
double dz = n.z - a.z;
if (dz > 0) {
return 1;
} else if (dz < 0) {
return -1;
} else {
return 0;
}
}
/**
*检查给定点是否在半空间内的方法。
*
*@return 1如果在里面,则返回0如果在线路上,否则返回-1。
*/
int isInside(点3D x){
点3d n=a.法线(b,x);
双dz=n.z-a.z;
如果(dz>0){
返回1;
}else if(dz<0){
返回-1;
}否则{
返回0;
}
}
据我所知,该算法在每次迭代中从不属于凸包的点集合和添加到凸包的最后一个点集合中选择一个点。然后在这两个点之间创建一条线。如果其他点都不在外侧,则所选点是后续点,并添加到proc集合中essed points.是这样吗?这叫凸包算法:DYeah,但它的确切名称是什么?我需要我的科学论文的名称:3它类似于Jarvis March。谢谢!现在我看到了。它叫凸包算法:DYeah,但它的确切名称是什么?我需要我的科学论文的名称:3它类似于Jarvis March。Thank你!现在我看到了。