[C# Helper]
Index Books FAQ Contact About Rod
[Beginning Database Design Solutions, Second Edition]

[Beginning Software Engineering, Second Edition]

[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Rotate a tetrahedron using XAML and C#

rotate a tetrahedron

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.

© 2009-2023 Rocky Mountain Computer Consulting, Inc. All rights reserved.