privatevoidCreateVertices () { … int v = 0; for (int y = 0; y <= ySize; y++) { for (int x = 0; x <= xSize; x++) { SetVertex(v++, x, y, 0); } for (int z = 1; z <= zSize; z++) { SetVertex(v++, xSize, y, z); } for (int x = xSize - 1; x >= 0; x--) { SetVertex(v++, x, y, zSize); } for (int z = zSize - 1; z > 0; z--) { SetVertex(v++, 0, y, z); } } for (int z = 1; z < zSize; z++) { for (int x = 1; x < xSize; x++) { SetVertex(v++, x, ySize, z); } } for (int z = 1; z < zSize; z++) { for (int x = 1; x < xSize; x++) { SetVertex(v++, x, 0, z); } }
圆形cube表面的点可以被起始于内部并且沿着法线方向移动的量等于圆滑值的点所达到。 –我的理解 圆形立方体的表面点可以从内点开始,沿着法线方向移动,其量等于圆度. – 百度翻译 The surface points of the rounded cube can then be found by starting at the inner point and moving along the normal by an amount equal to the roundness. – 原文
下面是参考代码,并未计算出内部的点
1 2 3 4 5 6
privatevoidSetVertex (int i, int x, int y, int z) { Vector3 inner = vertices[i] = new Vector3(x, y, z);