使用numberoftriangles,trianglelist,pointlist。對於每個三角形,在三角形列表中有三個數字,它們是三角形三角的點列表內的索引。他們不直接給你頂點,但你可以很容易地從那裏得到它們。
讓我知道如果它仍然不清楚。
for (int i = 0; i < numberoftriangles; ++i) {
int point1Index = trianglelist[i * 3 + 0];
int point2Index = trianglelist[i * 3 + 1];
int point3Index = trianglelist[i * 3 + 2];
REAL point1X = pointlist[2 * point1Index + 0];
REAL point1Y = pointlist[2 * point1Index + 1];
... etc
}
/* `trianglelist': An array of triangle corners. The first triangle's */
/* first corner is at index [0], followed by its other two corners in */
/* counterclockwise order, followed by any other nodes if the triangle */
/* represents a nonlinear element. Each triangle occupies */
/* `numberofcorners' ints. */
/* `pointlist': An array of point coordinates. The first point's x */
/* coordinate is at index [0] and its y coordinate at index [1], followed */
/* by the coordinates of the remaining points. Each point occupies two */
/* REALs.
我忘了提及我正在使用C++包裝三角形++ – jokoon