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, ...

Get 3D Programming for Windows® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.