WPF is cool stuff

So I was trying out the other day the new features that are available in Windows Presentation Foundation (WPF), I really like the idea of developing and creating 3D object and scenes because it is very easy compared to what it used to be in the past, now I can construct my 3D object programmatically using code like C# or I can also define the the 3D objects in the XAML file.

In this case I started with a demo application that show some of the features of a WPF library called 3D tools, I used that as my skeleton application and build on top of that and create teh 3D object that I want to display.

I first started with a sphere where inside that sphere I  created an icosahedron, for all of the triangular faces of the icosahedron I recursively dived it into 4 more triangles and projected the new vertices into the sphere to create more triangles in my mesh,  so the more recursive calls I make then the more triangles I get in my mesh.

Finally after my desire resolution of triangles I paint every triangle with a color depending on the area of each triangle in relation to the area of all the triangles.

It sounds complicated but its pretty simple, and the application app looks pretty cool specially because the 3D tools library allows to zoom and rotate the object in my scene without me having to write that.

WPF Frame 1 WPF Frame 2 WPF Frame 3

Next Post »