tags:

views:

250

answers:

1

What is the simplest way to programatically create a GeometryModel3D cube in wpf?

+1  A: 

The simplest method? It all depends on your point of view.

I'd say this kind of thing is pretty "simple":

return new GeometryModel3D
{
  Material = ...,
  Geometry = new Geometry
  {
    Points = new Point3DCollection
    {
      new Point3D(0,0,0),
      ...
    },
    TriangleIndices = new Int32Collection
    {
      ...
    },
    ...
  },
  ...
};

But others might consider a single call to XamlReader.Parse("...put your xaml here...") as more simple.

It's a judgement call.

Ray Burns
Thanks, this pointed me in the right direction. I was hoping there was a built in library that would create primitive objects
Michael