Title: Rotate a tetrahedron using XAML and C#
This example is similar to Rotate a 3D cube using XAML and C# except it shows how to build and rotate a tetrahedron instead of a cube. See the previous example for the basics.
This example uses the following XAML code to define the tetrahedron's vertices and triangles.
<! Tetrahedron >
<MeshGeometry3D
Positions="
0, 0, 1.15470053837925150,
1, 0, 0.57735026918962584,
1, 0, 0.57735026918962584,
0, 1.6329931618554521, 0
"
TriangleIndices="
3 1 0 3 2 1
3 0 2 0 1 2
" />
</GeometryModel3D.Geometry>
These points produce a tetrahedron with edges of length 2. The result is fairly small so this program includes the following transformation to enlarge the tetrahedron by a factor of 2.
<GeometryModel3D.Transform>
<ScaleTransform3D ScaleX="2" ScaleY="2" ScaleZ="2" />
</GeometryModel3D.Transform>
Download the example to experiment with it and to see additional details.
