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

Triangulation Resources

You can't derive a class from MeshGeometry3D, but all is not lost. Instead, you can define a mesh-generation class to be used as a resource in XAML files, and then refer to that resource in your markup with a data binding.

Resource Mechanics

Here's a mesh-generation class that doesn't explicitly inherit from anything:

namespace MyMeshGeometryLibrary
{
    public class SphereMeshGenerator
    {
        ...
        public MeshGeometry3D Geometry
        {
            get { ... }
        }
        ...
    }
}

This SphereMeshGenerator class probably has several properties named Slices, Stacks, Radius, and Center, but it also has a get-only property of type MeshGeometry3D that I've named Geometry. The get-accessor of this Geometry property creates a new MeshGeometry3D, fills all four collections, ...

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