O'Reilly logo

3D Programming for Windows® by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining Flat Rectangles

One step up from the triangle on the MeshGeometry3D complexity ladder is the rectangle. As with the triangle, I want to put the rectangle on the negative Z axis with the following vertices:

RectangleOnAxes.xaml

Figure 1-21. RectangleOnAxes.xaml

The Positions property of the MeshGeometry3D might be defined like so:

<MeshGeometry3D Positions="0 1 -4, 0 0 -4, 0 1 0, 0 0 0" ... />

The order of the points in this collection doesn't matter except when it comes time to define the TriangleIndices collection. A line drawn through the preceding rectangle shows how it can be divided into two triangles. The TriangleIndices collection consists of two triplets, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required