Start by building an icosahedron as described in the tutorial, Drawing Platonic Solids. Tile each of the icosahedron's faces with triangles as shown in Figure 1. Use more triangles for a smoother sphere.
Tiling an icosahedron's face with 9 triangles.
Next push the newly created points out to the radius of the sphere. In other words, if the sphere has radius R and a point (X, Y, Z), move it to:
new_X = X * R / Sqr(X * X + Y * Y + Z * Z)
new_Y = Y * R / Sqr(X * X + Y * Y + Z * Z)
new_Z = Z * R / Sqr(X * X + Y * Y + Z * Z)
Figure 2 shows a geodesic sphere where each face on the icosahedron was tiled with only 4 triangles. The image on the left shows the results as a wireframe with backfaces removed. The image on the right shows the sphere drawn using ray tracing.
The resulting geodesic sphere in wireframe and ray tracing.
Both of these images were drawn using the the VBRay program described in Chapter 17 of my book Visual Basic Graphics Programming. The example program available here for download generates face data that describes the geodesic sphere for that program.
See also: Make a stellate geodesic sphere.
|