Generating vertices for a sphere

后端 未结 2 1488
礼貌的吻别
礼貌的吻别 2021-01-31 21:04

In the DirectX mobile lighting sample, a cylinder is generated in the following manner:

for( DWORD i=0; i<50; i++ )
            {
                FLOAT theta          


        
2条回答
  •  情深已故
    2021-01-31 21:52

    The usual way to triangulate a unit sphere is to build a tetrahedron or a icosahedron and

    • If precision is enough, stop
    • Else, for each existing face:
    • Add a vertex at the midpoint of each edge and normalize it so that it is on the unit sphere
    • Replace the face with four new faces. One of the faces has the three new midpoints as corners (draw it on paper, and the other three faces will become obvious)
    • Loop.

    To avoid duplicating vertexes at the edge midpoints, you need to track the existing vertices for reuse.

提交回复
热议问题