Make a stellate geodesic sphere with WPF and C#

[stellate geodesic sphere]

Building Stellate Geodesic Spheres

A stellate geodesic sphere is one where each of the sphere’s faces is replaced by a pyramid shape. You can give the pyramids whatever height you like. For example, Figure 1 shows spheres where the pyramid is fairly short (left), very tall (middle), and inverted so it sticks into the sphere (right).

[stellate geodesic sphere]

[stellate geodesic sphere]
When people build geodesic domes, they sometimes make them stellate, probably partly to make them look cooler and partly to make them stronger. (A pyramid is stronger than a single large triangular face.) The Spaceship Earth sphere in Epcot Center shown in Figure 2 is a good example.

[stellate geodesic sphere]
To make a stellate geodesic sphere, start by making a geodesic sphere with as many sides as you require. Then find the center point of each face and move that point to some selected distance from the center of the sphere as shown in Figure 3.

Example Code

This example program is similar to the previous one that builds geodesic spheres except, after it builds the sphere, it replaces its faces with pyramids. To make the pyramids, the Triangle class provides the following Stellate method.

// Make triangles to stellate this triangle.
public void Stellate(List triangles, Point3D center, double radius)
    // Find the point in the middle of the triangle.
    Point3D peak = new Point3D(
        (Points[0].X + Points[1].X + Points[2].X) / 3.0,
        (Points[0].Y + Points[1].Y + Points[2].Y) / 3.0,
        (Points[0].Z + Points[1].Z + Points[2].Z) / 3.0);

    // Give the peak its desired radius.
    NormalizePoint(ref peak, center, radius);

    // Make the new triangles.
    triangles.Add(new Triangle(Points[0], Points[1], peak));
    triangles.Add(new Triangle(Points[1], Points[2], peak));
    triangles.Add(new Triangle(Points[2], Points[0], peak));

This code averages the coordinates of the triangle’s three vertices to get the center point. It then calls the NormalizePoint method defined by the previous example to move that point to a specified distance from the center of the sphere. It finishes by creating three new triangles to build the face’s pyramid.

The only other new code is in the main program. After it finishes building the geodesic sphere, it calls each face’s Stellate method. and that’s all there is to it. Download the example and look at the code for additional details.

Download Example   Follow me on Twitter   RSS feed   Donate

About RodStephens

Rod Stephens is a software consultant and author who has written more than 30 books and 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java.
This entry was posted in algorithms, graphics, mathematics, wpf and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

1 Response to Make a stellate geodesic sphere with WPF and C#

  1. Pingback: Factal Patterns & Art - Page 2

Comments are closed.