我遇到了这个问题。我想创建一个六边形网格,并能够以以下方式进行创建:
//grid extents
int numCols,numRows;
for (int i=0; i<numCols; ++i){
for (int j=0; j<numRows; ++j){
//x and y coordinates of my hexagon's vertices
float xpos,ypos;
//2D array storing verteces of my hextopology
vertices[i][j] = new VertexClass(xpos, ypos);
// statements to change xpos/ypos and create hex
}
}
我找到的所有制作六边形网格的方法,都是首先创建一个六边形对象,然后在网格上复制它,从而创建重复的顶点位置并连接边缘。我想避免重复顶点位置。如何声明语句来制作这样的网格?
谢谢