Title: Make a stellate geodesic sphere with WPF and C#
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).
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.
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 to experiment with it and to see additional details.
|