SilverLight 2.0 Mesh Viewer
SilverLight specification and use of XAML, drives one to inspect this platform. The use of standards is what enables manageable integration, and improves software maintenance. Having such platform integrated in .Net framework and available for developers, encourages one to experiment a little by using it.
Mesh viewers are common in CAD, and there are many available tools and libraries to develop and view complex mesh nets. In short a mesh is a net of connected faces, and a face is a set of vertices.
I created a humble very basic .Net Mesh Library that is free for anyone interested in improving and using it. This library can be used in .Net application, all that changes is the way of connecting two points i.e. drawing a line.
In windows application you can draw a line by using the Graphics object method DrawLine, in SilverLight you draw a line by creating a Line object and adding it to the main Canvas.
void engine_OnDrawLine(MeshSilverlightLibrary.Common.Point start, MeshSilverlightLibrary.Common.Point end)
{
Line l = new Line();
l.X1 = (float.IsNaN(start.X) ? 0 : start.X);
l.Y1 = (float.IsNaN(start.Y) ? 0 : start.Y);
l.X2 = (float.IsNaN(end.X) ? 0 : end.X);
l.Y2 = (float.IsNaN(end.Y) ? 0 : end.Y);
l.Stroke = new SolidColorBrush(Colors.Blue);
l.StrokeThickness = 1;
LayoutRoot.Children.Add(l);
}
Regards
Rabeeh Abla