diff --git a/Triangle.NET/MeshRenderer.Core/BoundingBox.cs b/Triangle.NET/MeshRenderer.Core/BoundingBox.cs
new file mode 100644
index 0000000..9ec9e8d
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/BoundingBox.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+
+namespace MeshRenderer.Core
+{
+ public struct BoundingBox
+ {
+ public float Left;
+ public float Right;
+ public float Bottom;
+ public float Top;
+
+ public float Width
+ {
+ get { return this.Right - this.Left; }
+ }
+
+ public float Height
+ {
+ get { return this.Top - this.Bottom; }
+ }
+
+ public BoundingBox(float left, float right, float bottom, float top)
+ {
+ this.Left = left;
+ this.Right = right;
+ this.Bottom = bottom;
+ this.Top = top;
+ }
+
+ public void Update(Point pt)
+ {
+ this.Update(pt.X, pt.Y);
+ }
+
+ public void Update(PointF pt)
+ {
+ this.Update(pt.X, pt.Y);
+ }
+
+ public void Update(double x, double y)
+ {
+ // Update bounding box
+ if (this.Left > x) this.Left = (float)x;
+ if (this.Right < x) this.Right = (float)x;
+ if (this.Bottom > y) this.Bottom = (float)y;
+ if (this.Top < y) this.Top = (float)y;
+ }
+
+ public void Reset()
+ {
+ this.Left = float.MaxValue;
+ this.Right = -float.MaxValue;
+ this.Bottom = float.MaxValue;
+ this.Top = -float.MaxValue;
+ }
+ }
+}
diff --git a/Triangle.NET/MeshRenderer.Core/ColorManager.cs b/Triangle.NET/MeshRenderer.Core/ColorManager.cs
new file mode 100644
index 0000000..f2c1577
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/ColorManager.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+
+namespace MeshRenderer.Core
+{
+ public class ColorManager
+ {
+ ///
+ /// Gets a color scheme with black background.
+ ///
+ public static ColorManager Default()
+ {
+ var colors = new ColorManager();
+
+ colors.Background = Color.FromArgb(0, 0, 0);
+ colors.Point = new SolidBrush(Color.Green);
+ colors.SteinerPoint = new SolidBrush(Color.Peru);
+ colors.Triangle = new SolidBrush(Color.Black);
+ colors.Line = new Pen(Color.FromArgb(30, 30, 30));
+ colors.Segment = new Pen(Color.DarkBlue);
+ colors.VoronoiLine = new Pen(Color.FromArgb(40, 50, 60));
+
+ return colors;
+ }
+
+ ///
+ /// Gets a color scheme with white background.
+ ///
+ public static ColorManager LightScheme()
+ {
+ var colors = new ColorManager();
+
+ colors.Background = Color.White;
+ colors.Point = new SolidBrush(Color.FromArgb(60, 80, 120));
+ colors.SteinerPoint = new SolidBrush(Color.DarkGreen);
+ colors.Triangle = new SolidBrush(Color.FromArgb(230, 240, 250));
+ colors.Line = new Pen(Color.FromArgb(150, 150, 150));
+ colors.Segment = new Pen(Color.SteelBlue);
+ colors.VoronoiLine = new Pen(Color.FromArgb(160, 170, 180));
+
+ return colors;
+ }
+
+ internal Color background;
+ internal SolidBrush point;
+ internal SolidBrush steinerPoint;
+ internal SolidBrush triangle;
+ internal Pen line;
+ internal Pen segment;
+ internal Pen voronoiLine;
+
+ #region Public properties
+
+ public Color Background
+ {
+ get { return background; }
+ set { background = value; }
+ }
+
+ public SolidBrush Point
+ {
+ get { return point; }
+ set
+ {
+ if (point != null) point.Dispose();
+ point = value;
+ }
+ }
+
+ public SolidBrush SteinerPoint
+ {
+ get { return steinerPoint; }
+ set
+ {
+ if (steinerPoint != null) steinerPoint.Dispose();
+ steinerPoint = value;
+ }
+ }
+
+ public SolidBrush Triangle
+ {
+ get { return triangle; }
+ set
+ {
+ if (triangle != null) triangle.Dispose();
+ triangle = value;
+ }
+ }
+
+ public Pen Line
+ {
+ get { return line; }
+ set
+ {
+ if (line != null) line.Dispose();
+ line = value;
+ }
+ }
+
+ public Pen Segment
+ {
+ get { return segment; }
+ set
+ {
+ if (segment != null) segment.Dispose();
+ segment = value;
+ }
+ }
+
+ public Pen VoronoiLine
+ {
+ get { return voronoiLine; }
+ set
+ {
+ if (voronoiLine != null) voronoiLine.Dispose();
+ voronoiLine = value;
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Triangle.NET/MeshRenderer.Core/ExtensionMethods.cs b/Triangle.NET/MeshRenderer.Core/ExtensionMethods.cs
new file mode 100644
index 0000000..27bd7a5
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/ExtensionMethods.cs
@@ -0,0 +1,34 @@
+// -----------------------------------------------------------------------
+//
+// TODO: Update copyright text.
+//
+// -----------------------------------------------------------------------
+
+namespace MeshRenderer.Core
+{
+ using System;
+ using System.Drawing;
+
+ ///
+ /// Extension methods.
+ ///
+ public static class ExtensionMethods
+ {
+ #region Color extention methods
+
+ ///
+ /// Converts a Color to a float array containing normalized R, G ,B, A values.
+ ///
+ public static float[] ToFloatArray4(this Color color)
+ {
+ return new float[] {
+ ((float)color.R) / 255.0f,
+ ((float)color.G) / 255.0f,
+ ((float)color.B) / 255.0f,
+ ((float)color.A) / 255.0f
+ };
+ }
+
+ #endregion
+ }
+}
diff --git a/Triangle.NET/TestApp/Rendering/MeshRenderer.cs b/Triangle.NET/MeshRenderer.Core/GDI/MeshRenderer.cs
similarity index 56%
rename from Triangle.NET/TestApp/Rendering/MeshRenderer.cs
rename to Triangle.NET/MeshRenderer.Core/GDI/MeshRenderer.cs
index 423052e..1b4a66f 100644
--- a/Triangle.NET/TestApp/Rendering/MeshRenderer.cs
+++ b/Triangle.NET/MeshRenderer.Core/GDI/MeshRenderer.cs
@@ -4,7 +4,7 @@
//
// -----------------------------------------------------------------------
-namespace MeshExplorer.Rendering
+namespace MeshRenderer.Core.GDI
{
using System;
using System.Collections.Generic;
@@ -20,7 +20,7 @@ namespace MeshExplorer.Rendering
{
Zoom zoom;
RenderData data;
- RenderColors renderColors;
+ ColorManager renderColors;
///
/// Initializes a new instance of the class.
@@ -33,12 +33,12 @@ namespace MeshExplorer.Rendering
///
/// Renders the mesh.
///
- public void Render(Graphics g, Zoom zoom, RenderColors renderColors)
+ public void Render(Graphics g, Zoom zoom, ColorManager renderColors)
{
this.renderColors = renderColors;
this.zoom = zoom;
- if (data.Edges != null)
+ if (data.MeshEdges != null)
{
this.RenderEdges(g);
}
@@ -61,12 +61,12 @@ namespace MeshExplorer.Rendering
///
/// Renders only the mesh edges (no points or segments).
///
- public void RenderMesh(Graphics g, Zoom zoom, RenderColors renderColors)
+ public void RenderMesh(Graphics g, Zoom zoom, ColorManager renderColors)
{
this.renderColors = renderColors;
this.zoom = zoom;
- if (data.Edges != null)
+ if (data.MeshEdges != null)
{
this.RenderEdges(g);
}
@@ -79,7 +79,7 @@ namespace MeshExplorer.Rendering
///
/// Renders only points and segments (no mesh triangles).
///
- public void RenderGeometry(Graphics g, Zoom zoom, RenderColors renderColors)
+ public void RenderGeometry(Graphics g, Zoom zoom, ColorManager renderColors)
{
this.renderColors = renderColors;
this.zoom = zoom;
@@ -97,28 +97,30 @@ namespace MeshExplorer.Rendering
private void RenderPoints(Graphics g)
{
+ int i, k, n;
PointF pt;
- PointF[] pts = data.Points;
- int i, n;
+ float[] pts = data.Points;
// Draw input points
n = data.NumberOfInputPoints;
for (i = 0; i < n; i++)
{
- if (zoom.ViewportContains(pts[i]))
+ k = 2 * i;
+ if (zoom.ViewportContains(pts[k], pts[k + 1]))
{
- pt = zoom.WorldToScreen(pts[i]);
+ pt = zoom.WorldToScreen(pts[k], pts[k + 1]);
g.FillEllipse(renderColors.Point, pt.X - 1.5f, pt.Y - 1.5f, 3, 3);
}
}
// Draw Steiner points
- n = pts.Length;
+ n = pts.Length / 2;
for (; i < n; i++)
{
- if (zoom.ViewportContains(pts[i]))
+ k = 2 * i;
+ if (zoom.ViewportContains(pts[k], pts[k + 1]))
{
- pt = zoom.WorldToScreen(pts[i]);
+ pt = zoom.WorldToScreen(pts[k], pts[k + 1]);
g.FillEllipse(renderColors.SteinerPoint, pt.X - 1.5f, pt.Y - 1.5f, 3, 3);
}
}
@@ -126,21 +128,25 @@ namespace MeshExplorer.Rendering
private void RenderTriangles(Graphics g)
{
+ int n = data.Triangles.Length / 3;
+ uint k0, k1, k2;
PointF p0, p1, p2;
- PointF[] pts = data.Points;
-
- var triangles = data.Triangles;
+ float[] pts = data.Points;
// Draw triangles
- foreach (var tri in triangles)
+ for (int i = 0; i < n; i++)
{
- if (zoom.ViewportContains(pts[tri.P0]) ||
- zoom.ViewportContains(pts[tri.P1]) ||
- zoom.ViewportContains(pts[tri.P2]))
+ k0 = 2 * data.Triangles[3 * i];
+ k1 = 2 * data.Triangles[3 * i + 1];
+ k2 = 2 * data.Triangles[3 * i + 2];
+
+ if (zoom.ViewportContains(pts[k0], pts[k0 + 1]) ||
+ zoom.ViewportContains(pts[k1], pts[k1 + 1]) ||
+ zoom.ViewportContains(pts[k2], pts[k2 + 1]))
{
- p0 = zoom.WorldToScreen(pts[tri.P0]);
- p1 = zoom.WorldToScreen(pts[tri.P1]);
- p2 = zoom.WorldToScreen(pts[tri.P2]);
+ p0 = zoom.WorldToScreen(pts[k0], pts[k0 + 1]);
+ p1 = zoom.WorldToScreen(pts[k1], pts[k1 + 1]);
+ p2 = zoom.WorldToScreen(pts[k2], pts[k2 + 1]);
g.DrawLine(renderColors.Line, p0, p1);
g.DrawLine(renderColors.Line, p1, p2);
@@ -151,19 +157,22 @@ namespace MeshExplorer.Rendering
private void RenderEdges(Graphics g)
{
+ int n = data.MeshEdges.Length / 2;
+ uint k0, k1;
PointF p0, p1;
- PointF[] pts = data.Points;
-
- var edges = data.Edges;
+ float[] pts = data.Points;
// Draw edges
- foreach (var edge in edges)
+ for (int i = 0; i < n; i++)
{
- if (zoom.ViewportContains(pts[edge.P0]) ||
- zoom.ViewportContains(pts[edge.P1]))
+ k0 = 2 * data.MeshEdges[2 * i];
+ k1 = 2 * data.MeshEdges[2 * i + 1];
+
+ if (zoom.ViewportContains(pts[k0], pts[k0 + 1]) ||
+ zoom.ViewportContains(pts[k1], pts[k1 + 1]))
{
- p0 = zoom.WorldToScreen(pts[edge.P0]);
- p1 = zoom.WorldToScreen(pts[edge.P1]);
+ p0 = zoom.WorldToScreen(pts[k0], pts[k0 + 1]);
+ p1 = zoom.WorldToScreen(pts[k1], pts[k1 + 1]);
g.DrawLine(renderColors.Line, p0, p1);
}
@@ -172,18 +181,22 @@ namespace MeshExplorer.Rendering
private void RenderSegments(Graphics g)
{
+ int n = data.Segments.Length / 2;
+ uint k0, k1;
PointF p0, p1;
- PointF[] pts = data.Points;
+ float[] pts = data.Points;
- var segments = data.Segments;
-
- foreach (var seg in segments)
+ // Draw edges
+ for (int i = 0; i < n; i++)
{
- if (zoom.ViewportContains(pts[seg.P0]) ||
- zoom.ViewportContains(pts[seg.P1]))
+ k0 = 2 * data.Segments[2 * i];
+ k1 = 2 * data.Segments[2 * i + 1];
+
+ if (zoom.ViewportContains(pts[k0], pts[k0 + 1]) ||
+ zoom.ViewportContains(pts[k1], pts[k1 + 1]))
{
- p0 = zoom.WorldToScreen(pts[seg.P0]);
- p1 = zoom.WorldToScreen(pts[seg.P1]);
+ p0 = zoom.WorldToScreen(pts[k0], pts[k0 + 1]);
+ p1 = zoom.WorldToScreen(pts[k1], pts[k1 + 1]);
g.DrawLine(renderColors.Segment, p0, p1);
}
diff --git a/Triangle.NET/TestApp/Controls/RendererControl.cs b/Triangle.NET/MeshRenderer.Core/GDI/RenderControl.cs
similarity index 71%
rename from Triangle.NET/TestApp/Controls/RendererControl.cs
rename to Triangle.NET/MeshRenderer.Core/GDI/RenderControl.cs
index 9eb49e2..016011a 100644
--- a/Triangle.NET/TestApp/Controls/RendererControl.cs
+++ b/Triangle.NET/MeshRenderer.Core/GDI/RenderControl.cs
@@ -4,24 +4,20 @@
//
// -----------------------------------------------------------------------
-namespace MeshExplorer.Controls
+namespace MeshRenderer.Core.GDI
{
using System;
- using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Windows.Forms;
- using MeshExplorer.Rendering;
using TriangleNet;
- using TriangleNet.IO;
- using TriangleNet.Data;
using TriangleNet.Geometry;
///
/// Renders a mesh using GDI.
///
- public class RendererControl : Control
+ public class RenderControl : Control, IMeshRenderer
{
// Rendering stuff
private BufferedGraphics buffer;
@@ -33,7 +29,7 @@ namespace MeshExplorer.Controls
MeshRenderer meshRenderer;
VoronoiRenderer voronoiRenderer;
- RenderColors renderColors;
+ ColorManager renderColors;
bool initialized = false;
bool showVoronoi = false;
@@ -51,36 +47,17 @@ namespace MeshExplorer.Controls
}
///
- /// Indicates whether to show the voronoi diagram or not.
+ /// Initializes a new instance of the class.
///
- public bool ShowVoronoi
- {
- get { return showVoronoi; }
- set
- {
- showVoronoi = value;
-
- if (voronoiRenderer != null && showVoronoi)
- {
- voronoiRenderer.Update();
- }
-
- this.Render();
- }
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public RendererControl()
+ public RenderControl()
{
SetStyle(ControlStyles.ResizeRedraw, true);
- renderColors = RenderColors.Default();
+ renderColors = ColorManager.Default();
this.BackColor = renderColors.Background;
- zoom = new Zoom();
+ zoom = new Zoom(true);
context = new BufferedGraphicsContext();
data = new RenderData();
@@ -99,7 +76,7 @@ namespace MeshExplorer.Controls
///
public void Initialize()
{
- zoom.Initialize(this.ClientRectangle, this.ClientRectangle);
+ zoom.Initialize(this.ClientRectangle);
InitializeBuffer();
initialized = true;
@@ -110,12 +87,19 @@ namespace MeshExplorer.Controls
///
/// Updates the displayed input data.
///
- public void SetData(InputGeometry geometry)
+ public void SetData(RenderData data)
{
- data.SetData(geometry);
+ this.data = data;
meshRenderer = new MeshRenderer(data);
+ this.showVoronoi = data.VoronoiPoints != null;
+
+ if (showVoronoi)
+ {
+ voronoiRenderer = new VoronoiRenderer(data);
+ }
+
// Reset the zoom on new data
zoom.Initialize(this.ClientRectangle, data.Bounds);
@@ -124,51 +108,16 @@ namespace MeshExplorer.Controls
this.Render();
}
- ///
- /// Updates the displayed mesh data.
- ///
- /// If true, the zoom will be reset.
- public void SetData(Mesh mesh, bool initZoom)
- {
- data.SetData(mesh);
-
- if (initZoom)
- {
- // Reset the zoom on new data
- zoom.Initialize(this.ClientRectangle, data.Bounds);
- }
-
- meshRenderer = new MeshRenderer(data);
- voronoiRenderer = new VoronoiRenderer(mesh);
-
- if (showVoronoi)
- {
- voronoiRenderer.Update();
- }
-
- initialized = true;
-
- this.Render();
- }
-
- ///
- /// Updates the displayed input data.
- ///
- public void SetData(Mesh mesh)
- {
- SetData(mesh, false);
- }
-
///
/// Zoom to the given location.
///
/// The zoom focus.
/// Indicates whether to zoom in or out.
- public void Zoom(PointF location, int delta)
+ public void Zoom(float x, float y, int delta)
{
if (!initialized) return;
- if (zoom.Update(delta, location.X / (float)this.Width, location.Y / (float)this.Height))
+ if (zoom.ZoomUpdate(delta, x, y))
{
// Redraw
this.Render();
@@ -180,7 +129,7 @@ namespace MeshExplorer.Controls
///
public void HandleResize()
{
- zoom.Resize(this.ClientRectangle, data.Bounds);
+ zoom.Initialize(this.ClientRectangle, data.Bounds);
InitializeBuffer();
}
@@ -270,11 +219,12 @@ namespace MeshExplorer.Controls
if (e.Button == MouseButtons.Middle)
{
- zoom.Reset();
+ zoom.ZoomReset();
this.Render();
}
else if (e.Button == MouseButtons.Left)
{
+ /*
// Just in case ...
timer.Stop();
@@ -286,6 +236,7 @@ namespace MeshExplorer.Controls
this.Invalidate();
timer.Start();
+ * */
}
base.OnMouseClick(e);
diff --git a/Triangle.NET/MeshRenderer.Core/GDI/VoronoiRenderer.cs b/Triangle.NET/MeshRenderer.Core/GDI/VoronoiRenderer.cs
new file mode 100644
index 0000000..5ab6bd8
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/GDI/VoronoiRenderer.cs
@@ -0,0 +1,72 @@
+// -----------------------------------------------------------------------
+//
+// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
+//
+// -----------------------------------------------------------------------
+
+namespace MeshRenderer.Core.GDI
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Drawing;
+ using System.Linq;
+ using System.Text;
+ using TriangleNet;
+ using TriangleNet.Tools;
+
+ ///
+ /// Renders a (bounded) Voronoi diagram.
+ ///
+ public class VoronoiRenderer
+ {
+ RenderData data;
+ ColorManager renderColors;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public VoronoiRenderer(RenderData data)
+ {
+ this.data = data;
+ }
+
+ ///
+ /// Renders the voronoi diagram.
+ ///
+ public void Render(Graphics g, Zoom zoom, ColorManager renderColors)
+ {
+ this.renderColors = renderColors;
+
+ var points = data.VoronoiPoints;
+ var edges = data.VoronoiEdges;
+
+ if (points != null && edges != null)
+ {
+ uint k;
+ PointF p0, p1;
+ int n = edges.Length / 2;
+
+ for (int i = 0; i < n; i++)
+ {
+ // First endpoint of voronoi edge
+ k = edges[2 * i];
+ p0 = new PointF(points[2 * k], points[2 * k + 1]);
+
+ // Second endpoint of voronoi edge
+ k = edges[2 * i + 1];
+ p1 = new PointF(points[2 * k], points[2 * k + 1]);
+
+ // Render the edge
+ if (zoom.ViewportContains(p0.X, p0.Y) ||
+ zoom.ViewportContains(p1.X, p1.Y))
+ {
+ p0 = zoom.WorldToScreen(p0.X, p0.Y);
+ p1 = zoom.WorldToScreen(p1.X, p1.Y);
+
+ g.DrawLine(renderColors.VoronoiLine, p0, p1);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Triangle.NET/MeshRenderer.Core/IMeshRenderer.cs b/Triangle.NET/MeshRenderer.Core/IMeshRenderer.cs
new file mode 100644
index 0000000..ce7030b
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/IMeshRenderer.cs
@@ -0,0 +1,27 @@
+// -----------------------------------------------------------------------
+//
+// TODO: Update copyright text.
+//
+// -----------------------------------------------------------------------
+
+namespace MeshRenderer.Core
+{
+ using System;
+
+ ///
+ /// TODO: Update summary.
+ ///
+ public interface IMeshRenderer
+ {
+ void Zoom(float x, float y, int delta);
+ void HandleResize();
+
+ void Initialize();
+
+ void SetData(RenderData data);
+
+ //void SetPoints(float[] points, int inputPoints);
+ //void SetTriangles(uint[] triangles);
+ //void SetSegments(uint[] segments);
+ }
+}
diff --git a/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj b/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj
new file mode 100644
index 0000000..7f44c4c
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj
@@ -0,0 +1,73 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.30703
+ 2.0
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}
+ Library
+ Properties
+ MeshRenderer.Core
+ MeshRenderer.Core
+ v4.0
+ 512
+ SAK
+ SAK
+ SAK
+ SAK
+ Client
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+
+
+
+
+
+
+
+
+
+ {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}
+ Triangle
+
+
+
+
+
\ No newline at end of file
diff --git a/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj.vspscc b/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj.vspscc
new file mode 100644
index 0000000..feffdec
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/MeshRenderer.Core.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/Triangle.NET/MeshRenderer.Core/Properties/AssemblyInfo.cs b/Triangle.NET/MeshRenderer.Core/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..24f169e
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MeshRenderer.Core")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MeshRenderer.Core")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("99ca6350-3202-47b0-9645-d07b1ac4a294")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Triangle.NET/MeshRenderer.Core/RenderData.cs b/Triangle.NET/MeshRenderer.Core/RenderData.cs
new file mode 100644
index 0000000..be99868
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/RenderData.cs
@@ -0,0 +1,185 @@
+// -----------------------------------------------------------------------
+//
+// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
+//
+// -----------------------------------------------------------------------
+
+namespace MeshRenderer.Core
+{
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Drawing;
+ using TriangleNet;
+ using TriangleNet.Data;
+ using TriangleNet.Geometry;
+ using TriangleNet.Tools;
+
+ ///
+ /// Stores the current mesh in a rendering friendly data structure.
+ ///
+ public class RenderData
+ {
+ public float[] Points;
+ public uint[] Segments;
+ public uint[] Triangles;
+ public uint[] MeshEdges;
+ public float[] VoronoiPoints;
+ public uint[] VoronoiEdges;
+
+ public int NumberOfInputPoints;
+ public BoundingBox Bounds;
+
+ ///
+ /// Copy input geometry data.
+ ///
+ public void SetInputGeometry(InputGeometry data)
+ {
+ // Clear unused buffers
+ this.Segments = null;
+ this.Triangles = null;
+ this.MeshEdges = null;
+ this.VoronoiPoints = null;
+ this.VoronoiEdges = null;
+
+ int n = data.Count;
+ int i = 0;
+
+ this.NumberOfInputPoints = n;
+
+ // Copy points
+ this.Points = new float[2 * n];
+ foreach (var pt in data.Points)
+ {
+ this.Points[2 * i] = (float)pt.X;
+ this.Points[2 * i + 1] = (float)pt.Y;
+ i++;
+ }
+
+ // Copy segments
+ n = data.Segments.Count;
+ if (n > 0)
+ {
+ var segments = new List(2 * n);
+ foreach (var seg in data.Segments)
+ {
+ segments.Add((uint)seg.P0);
+ segments.Add((uint)seg.P1);
+ }
+ this.Segments = segments.ToArray();
+ }
+
+ this.Bounds = new BoundingBox(
+ (float)data.Bounds.Xmin,
+ (float)data.Bounds.Xmax,
+ (float)data.Bounds.Ymin,
+ (float)data.Bounds.Ymax);
+ }
+
+ ///
+ /// Copy mesh data.
+ ///
+ public void SetMesh(Mesh mesh)
+ {
+ // Clear unused buffers
+ this.Segments = null;
+ this.VoronoiPoints = null;
+ this.VoronoiEdges = null;
+
+ int n = mesh.Vertices.Count;
+ int i = 0;
+
+ this.NumberOfInputPoints = mesh.NumberOfInputPoints;
+
+ // Linear numbering of mesh
+ mesh.Renumber();
+
+ // Copy points
+ this.Points = new float[2 * n];
+ foreach (var pt in mesh.Vertices)
+ {
+ this.Points[2 * i] = (float)pt.X;
+ this.Points[2 * i + 1] = (float)pt.Y;
+ i++;
+ }
+
+ // Copy segments
+ n = mesh.Segments.Count;
+ if (n > 0)
+ {
+ var segments = new List(2 * n);
+ foreach (var seg in mesh.Segments)
+ {
+ segments.Add((uint)seg.P0);
+ segments.Add((uint)seg.P1);
+ }
+ this.Segments = segments.ToArray();
+ }
+
+ // Copy edges
+ var edges = new List(2 * mesh.NumberOfEdges);
+
+ EdgeEnumerator e = new EdgeEnumerator(mesh);
+ while (e.MoveNext())
+ {
+ edges.Add((uint)e.Current.P0);
+ edges.Add((uint)e.Current.P1);
+ }
+ this.MeshEdges = edges.ToArray();
+
+ // Copy Triangles
+ var triangles = new List(3 * mesh.Triangles.Count);
+ foreach (var tri in mesh.Triangles)
+ {
+ triangles.Add((uint)tri.P0);
+ triangles.Add((uint)tri.P1);
+ triangles.Add((uint)tri.P2);
+ }
+ this.Triangles = triangles.ToArray();
+
+ this.Bounds = new BoundingBox(
+ (float)mesh.Bounds.Xmin,
+ (float)mesh.Bounds.Xmax,
+ (float)mesh.Bounds.Ymin,
+ (float)mesh.Bounds.Ymax);
+ }
+
+ ///
+ /// Copy voronoi data.
+ ///
+ public void SetVoronoi(IVoronoi voro)
+ {
+ SetVoronoi(voro, 0);
+ }
+
+ ///
+ /// Copy voronoi data.
+ ///
+ public void SetVoronoi(IVoronoi voro, int infCount)
+ {
+ /*
+ int i, n = voro.VertexList.Count;
+
+ // Copy points
+ this.VoronoiPoints = new float[2 * n + infCount];
+ foreach (var v in voro.VertexList)
+ {
+ i = v.Id;
+ this.VoronoiPoints[2 * i] = (float)v.X;
+ this.VoronoiPoints[2 * i + 1] = (float)v.Y;
+ }
+
+ // Copy edges
+ var edges = new List(voro.HalfEdgeList.Count);
+ foreach (var edge in voro.Edges)
+ {
+ if (edge.P0 >= 0 && edge.P1 >= 0)
+ {
+ edges.Add((uint)edge.P0);
+ edges.Add((uint)edge.P1);
+ }
+ }
+ this.VoronoiEdges = edges.ToArray();
+ * */
+ }
+ }
+}
diff --git a/Triangle.NET/MeshRenderer.Core/RenderManager.cs b/Triangle.NET/MeshRenderer.Core/RenderManager.cs
new file mode 100644
index 0000000..7bbf7e2
--- /dev/null
+++ b/Triangle.NET/MeshRenderer.Core/RenderManager.cs
@@ -0,0 +1,112 @@
+// -----------------------------------------------------------------------
+//
+// TODO: Update copyright text.
+//
+// -----------------------------------------------------------------------
+
+namespace MeshRenderer.Core
+{
+ using System;
+ using System.IO;
+ using System.Linq;
+ using System.Reflection;
+ using System.Windows.Forms;
+
+ ///
+ /// This is a proxy to an actual IMeshRenderer instance.
+ ///
+ public class RenderManager : IMeshRenderer
+ {
+ IMeshRenderer renderer;
+
+ public Control RenderControl
+ {
+ get { return (Control)renderer; }
+ set
+ {
+ if (value is IMeshRenderer)
+ {
+ renderer = (IMeshRenderer)value;
+ }
+ }
+ }
+
+ public void Initialize()
+ {
+ renderer.Initialize();
+ }
+
+ public void Zoom(float x, float y, int delta)
+ {
+ renderer.Zoom(x, y, delta);
+ }
+
+ public void HandleResize()
+ {
+ renderer.HandleResize();
+ }
+
+ public void SetData(RenderData data)
+ {
+ renderer.SetData(data);
+ }
+
+ public void CreateDefaultControl()
+ {
+ this.RenderControl = new MeshRenderer.Core.GDI.RenderControl();
+ }
+
+ public bool CreateControl(string assemblyName)
+ {
+ return CreateControl(assemblyName, null);
+ }
+
+ public bool CreateControl(string assemblyName, string[] dependencies)
+ {
+ // Check if assembly exists
+ if (!File.Exists(assemblyName))
+ {
+ return false;
+ }
+
+ // Check if dependencies exists
+ if (dependencies != null)
+ {
+ foreach (var item in dependencies)
+ {
+ if (!File.Exists(item))
+ {
+ return false;
+ }
+ }
+ }
+
+ assemblyName = Path.GetFileNameWithoutExtension(assemblyName);
+
+ // Try creating renderer instance.
+ try
+ {
+ // Load the assembly into the current application domain.
+ Assembly assembly = Assembly.Load(assemblyName);
+
+ // Get all types implementing the IMeshRenderer interface.
+ var type = typeof(IMeshRenderer);
+ var types = assembly.GetTypes().Where(s => type.IsAssignableFrom(s)).ToArray();
+
+ if (types.Length > 0)
+ {
+ // Create an instance.
+ renderer = (IMeshRenderer)Activator.CreateInstance(types[0]);
+ }
+
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+
+ // Return true if render control was successfully created.
+ return (renderer != null);
+ }
+ }
+}
diff --git a/Triangle.NET/TestApp/Rendering/Zoom.cs b/Triangle.NET/MeshRenderer.Core/Zoom.cs
similarity index 57%
rename from Triangle.NET/TestApp/Rendering/Zoom.cs
rename to Triangle.NET/MeshRenderer.Core/Zoom.cs
index f04e334..1123805 100644
--- a/Triangle.NET/TestApp/Rendering/Zoom.cs
+++ b/Triangle.NET/MeshRenderer.Core/Zoom.cs
@@ -1,10 +1,10 @@
// -----------------------------------------------------------------------
//
-// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
+// TODO: Update copyright text.
//
// -----------------------------------------------------------------------
-namespace MeshExplorer.Rendering
+namespace MeshRenderer.Core
{
using System;
using System.Collections.Generic;
@@ -13,50 +13,61 @@ namespace MeshExplorer.Rendering
using System.Drawing;
///
- /// Manages the current world to screen transformation.
+ /// Manages the current world to screen transformation
///
public class Zoom
{
- ///
- /// Gets the screen dimensions (render control).
- ///
- Rectangle Screen { get; set; }
+ // The complete mesh
+ Rectangle Screen;
- ///
- /// Gets the world dimensions (mesh).
- ///
+ // The complete mesh
RectangleF World { get; set; }
- ///
- /// Gets the current viewport (visible mesh).
- ///
- public RectangleF Viewport { get; private set; }
+ // The current viewport (visible mesh)
+ public RectangleF Viewport { get; set; }
- ///
- /// Gets the current scale (zoom level)
- ///
- public int Level { get; private set; }
-
- public float ClipMargin { get; private set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public Zoom()
+ // Current scale (zoom level)
+ public float Scale
{
- Level = -1;
+ get { return Screen.Width / Viewport.Width; }
}
- ///
- /// Initialize the zoom.
- ///
- /// The screen dimensions.
- /// The world dimensions.
- public void Initialize(Rectangle screen, RectangleF world)
+ // Current scale (zoom level)
+ public int Level { get; private set; }
+
+ // Add a margin to clip region (5% of viewport width on each side)
+ public float ClipMargin { get; set; }
+
+ bool invertY = false;
+
+ public Zoom()
+ : this(false)
+ {
+ }
+
+ public Zoom(bool invertY)
+ {
+ Level = -1;
+ this.invertY = invertY;
+ }
+
+ public void Initialize(Rectangle screen)
+ {
+ this.Screen = screen;
+
+ this.Level = 1;
+
+ this.Viewport = screen;
+
+ this.ClipMargin = this.Viewport.Width * 0.05f;
+
+ this.World = screen;
+ }
+
+ public void Initialize(Rectangle screen, BoundingBox world)
{
this.Screen = screen;
- this.World = world;
this.Level = 1;
// Add a margin so there's some space around the border
@@ -73,8 +84,8 @@ namespace MeshExplorer.Rendering
scale = (world.Height + worldMargin) / screen.Height;
}
- float centerX = world.X + world.Width / 2;
- float centerY = world.Y + world.Height / 2;
+ float centerX = world.Left + world.Width / 2;
+ float centerY = world.Bottom + world.Height / 2;
// TODO: Add initial margin
this.Viewport = new RectangleF(centerX - screen.Width * scale / 2,
@@ -87,21 +98,29 @@ namespace MeshExplorer.Rendering
this.World = this.Viewport;
}
- public void Resize(Rectangle screen, RectangleF world)
+ public void Update(BoundingBox world)
{
- this.Initialize(screen, world);
+ if (this.Screen != null)
+ {
+ Initialize(this.Screen, world);
+ }
}
///
/// Zoom in or out of the viewport.
///
/// Zoom amount
- /// Relative x point position (between 0 and 1)
- /// Relative y point position (between 0 and 1)
- public bool Update(int amount, float focusX, float focusY)
+ /// Relative x point position
+ /// Relative y point position
+ public bool ZoomUpdate(int amount, float focusX, float focusY)
{
float width, height;
+ if (invertY)
+ {
+ focusY = 1 - focusY;
+ }
+
if (amount > 0) // Zoom in
{
this.Level++;
@@ -132,11 +151,11 @@ namespace MeshExplorer.Rendering
// Current focus on viewport
float x = Viewport.X + Viewport.Width * focusX;
- float y = Viewport.Y + Viewport.Height * (1 - focusY);
+ float y = Viewport.Y + Viewport.Height * focusY;
// New left and top positions
x = x - width * focusX;
- y = y - height * (1 - focusY);
+ y = y - height * focusY;
// Check if outside of world
if (x < World.X)
@@ -165,31 +184,28 @@ namespace MeshExplorer.Rendering
return true;
}
- ///
- /// Check current point (world coordinates) lies inside the viewport.
- ///
- public bool ViewportContains(PointF pt)
- {
- return (pt.X > Viewport.X && pt.X < Viewport.Right
- && pt.Y > Viewport.Y && pt.Y < Viewport.Bottom);
- }
-
- public PointF WorldToScreen(PointF pt)
- {
- return new PointF((pt.X - Viewport.X) / Viewport.Width * Screen.Width,
- (1 - (pt.Y - Viewport.Y) / Viewport.Height) * Screen.Height);
- }
-
- public PointF ScreenToWorld(float ptX, float ptY)
- {
- return new PointF(Viewport.X + Viewport.Width * ptX,
- Viewport.Y + Viewport.Height * (1 - ptY));
- }
-
- public void Reset()
+ public void ZoomReset()
{
this.Viewport = this.World;
this.Level = 1;
}
+
+ public bool ViewportContains(float x, float y)
+ {
+ return (x > Viewport.X && x < Viewport.Right
+ && y > Viewport.Y && y < Viewport.Bottom);
+ }
+
+ public PointF WorldToScreen(float x, float y)
+ {
+ return new PointF((x - Viewport.X) / Viewport.Width * Screen.Width,
+ (1 - (y - Viewport.Y) / Viewport.Height) * Screen.Height);
+ }
+
+ public PointF ScreenToWorld(float x, float y)
+ {
+ return new PointF(Viewport.X + Viewport.Width * x,
+ Viewport.Y + Viewport.Height * (1 - y));
+ }
}
}
diff --git a/Triangle.NET/TestApp/Examples.cs b/Triangle.NET/TestApp/Examples.cs
deleted file mode 100644
index 182c881..0000000
--- a/Triangle.NET/TestApp/Examples.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// TODO: Update copyright text.
-//
-// -----------------------------------------------------------------------
-
-namespace MeshExplorer
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using TriangleNet;
- using TriangleNet.IO;
- using TriangleNet.Geometry;
- using MeshExplorer.IO;
- using MeshExplorer.Rendering;
-
- ///
- /// Code of the online examples.
- ///
- public static class Examples
- {
- // Make sure this path points to the polygon sample data.
- static readonly string pathToData = @"..\..\..\Data\";
-
- static RasterImage imageWriter = new RasterImage();
-
- ///
- /// Generating Delaunay triangulations
- ///
- public static void Example1()
- {
- imageWriter.ColorScheme = RenderColors.LightScheme();
-
- // Create a mesh instance.
- Mesh mesh = new Mesh();
-
- // Read spiral node file and gernerate the delaunay triangulation
- // of the point set.
- mesh.Triangulate(pathToData + "spiral.node");
- imageWriter.Export(mesh, "spiral.png", 180);
-
- // Read face polygon file and gernerate the delaunay triangulation
- // of the PSLG. We reuse the mesh instance here.
- InputGeometry data = FileReader.Read(pathToData + "face.poly");
- mesh.Triangulate(data);
- imageWriter.Export(mesh, "face.png", 200);
-
- // Generate a conforming delaunay triangulation of the face polygon.
- mesh.SetOption(Options.ConformingDelaunay, true);
- mesh.Triangulate(data);
- imageWriter.Export(mesh, "face-CDT.png", 200);
- }
-
- ///
- /// Quality meshing: angle and size constraints
- ///
- public static void Example2()
- {
- imageWriter.ColorScheme = RenderColors.LightScheme();
-
- // Create a mesh instance.
- Mesh mesh = new Mesh();
-
- // Read spiral node file and gernerate the delaunay triangulation.
- // Set the mesh quality option to true, which will set a default
- // minimum angle of 20 degrees.
- InputGeometry data = FileReader.ReadNodeFile(pathToData + "spiral.node");
- mesh.SetOption(Options.Quality, true);
- mesh.Triangulate(data);
- imageWriter.Export(mesh, "spiral-Angle-20.png", 200);
-
- // Set a minimum angle of 30 degrees.
- mesh.SetOption(Options.MinAngle, 35);
- mesh.Triangulate(data);
- imageWriter.Export(mesh, "spiral-Angle-35.png", 200);
-
- // Reset the minimum angle and add a global area constraint.
- mesh.SetOption(Options.MinAngle, 20);
- mesh.SetOption(Options.MaxArea, 0.2);
- mesh.Triangulate(data);
- imageWriter.Export(mesh, "spiral-Area.png", 200);
- }
-
- ///
- /// Refining preexisting meshes
- ///
- public static void Example3()
- {
- imageWriter.ColorScheme = RenderColors.LightScheme();
-
- // Create a mesh instance.
- Mesh mesh = new Mesh();
-
- // Gernerate a quality delaunay triangulation of box
- // polygon, containing the convex hull.
- mesh.SetOption(Options.Quality, true);
- mesh.SetOption(Options.Convex, true);
- mesh.Triangulate(pathToData + "box.poly");
- imageWriter.Export(mesh, "box.png", 200);
-
- // Save the current mesh to .node and .ele files
- FileWriter.WriteNodes(mesh, "box.1.node");
- FileWriter.WriteElements(mesh, "box.1.ele");
-
- // Refine the mesh by setting a global area constraint.
- mesh.Refine(0.2);
- imageWriter.Export(mesh, "box-Refine-1.png", 200);
-
- // Refine again by setting a smaller area constraint.
- mesh.Refine(0.05);
- imageWriter.Export(mesh, "box-Refine-2.png", 200);
-
- // Load the previously saved box.1 mesh. Since a box.1.area
- // file exist, the variable area constraint option is set
- // and will be applied for refinement.
- mesh.Load(pathToData + "box.1.node");
- mesh.SetOption(Options.MinAngle, 0);
- mesh.Refine();
- imageWriter.Export(mesh, "box-Refine-3.png", 200);
- }
-
- ///
- /// Drawing the Voronoi diagram.
- ///
- public static void Example4()
- {
- //imageWriter.SetColorSchemeLight();
-
- //// Create mesh data (random point set)
- ////data.Points = Util.CreateCirclePoints(0, 0, 5, 50); // Ooops, TODO !!!
- //InputGeometry data = PolygonGenerator.CreateStarPoints(0, 0, 5, 10);
-
- //// Create a mesh instance.
- //Mesh mesh = new Mesh();
-
- //// Gernerate a delaunay triangulation
- //mesh.Triangulate(data);
- //ImageWriter.WritePng(mesh, "circle-mesh.png", 400);
- //ImageWriter.WriteVoronoiPng(mesh, "circle-voronoi.png", 400);
- }
-
- ///
- /// Smoothing a mesh.
- ///
- public static void Example5()
- {
- //ImageWriter.SetColorSchemeLight();
-
- //// Create a mesh instance.
- //Mesh mesh = new Mesh();
-
- //mesh.SetOption(Options.Quality, true);
- //mesh.SetOption(Options.MinAngle, 25);
- //mesh.SetOption(Options.MaxArea, 0.0075);
- //mesh.Triangulate(pathToData + "Smooth-Slit.poly");
- //mesh.Smooth();
-
- //ImageWriter.WritePng(mesh, "slit-smooth.png", 300);
- }
-
- ///
- /// Smoothing a mesh.
- ///
- public static void ExampleXYZ()
- {
- //ImageWriter.SetColorSchemeLight();
-
- //Mesh mesh = new Mesh();
-
- //mesh.SetOption(Options.Quality, true);
- //mesh.SetOption(Options.MinAngle, 25);
- //mesh.SetOption(Options.MaxArea, 0.05);
-
- //mesh.Triangulate(pathToData + "Smooth-Square.poly");
-
- //ImageWriter.WritePng(mesh, "test1.png", 300);
-
- //mesh.SetOption(Options.MaxArea, 0.01);
-
- //// Refine with new max area
- //mesh.Refine();
-
- //ImageWriter.WritePng(mesh, "test2.png", 300);
-
- //mesh.SetOption(Options.SteinerPoints, 50);
- //mesh.Triangulate(pathToData + "Smooth-Square.poly");
-
- //ImageWriter.WritePng(mesh, "test3.png", 300);
- }
- }
-}
diff --git a/Triangle.NET/TestApp/FormLog.cs b/Triangle.NET/TestApp/FormLog.cs
index 5ecf4af..d54ab91 100644
--- a/Triangle.NET/TestApp/FormLog.cs
+++ b/Triangle.NET/TestApp/FormLog.cs
@@ -17,6 +17,20 @@ namespace MeshExplorer
InitializeComponent();
}
+ public void AddItem(string message, bool warning)
+ {
+ ILog log = SimpleLog.Instance;
+
+ if (warning)
+ {
+ log.Warning(message, "Mesh Explorer");
+ }
+ else
+ {
+ log.Info(message);
+ }
+ }
+
public void UpdateItems()
{
listLog.Items.Clear();
diff --git a/Triangle.NET/TestApp/FormMain.Designer.cs b/Triangle.NET/TestApp/FormMain.Designer.cs
index 74ae0f7..a6437c1 100644
--- a/Triangle.NET/TestApp/FormMain.Designer.cs
+++ b/Triangle.NET/TestApp/FormMain.Designer.cs
@@ -32,60 +32,11 @@
this.btnSmooth = new MeshExplorer.Controls.DarkButton();
this.flatTabControl1 = new MeshExplorer.Controls.DarkTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
- this.lbMaxArea = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.lbMinAngle = new System.Windows.Forms.Label();
- this.label23 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.slMaxArea = new MeshExplorer.Controls.DarkSlider();
- this.slMinAngle = new MeshExplorer.Controls.DarkSlider();
- this.cbConformDel = new MeshExplorer.Controls.DarkCheckBox();
- this.cbConvex = new MeshExplorer.Controls.DarkCheckBox();
- this.cbQuality = new MeshExplorer.Controls.DarkCheckBox();
+ this.meshControlView = new MeshExplorer.Views.MeshControlView();
this.tabPage2 = new System.Windows.Forms.TabPage();
- this.label20 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.lbNumSeg = new System.Windows.Forms.Label();
- this.lbNumSeg2 = new System.Windows.Forms.Label();
- this.lbNumTri = new System.Windows.Forms.Label();
- this.lbNumTri2 = new System.Windows.Forms.Label();
- this.lbNumVert = new System.Windows.Forms.Label();
- this.lbNumVert2 = new System.Windows.Forms.Label();
- this.label32 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.label31 = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.label29 = new System.Windows.Forms.Label();
- this.label14 = new System.Windows.Forms.Label();
- this.lbAngleMax = new System.Windows.Forms.Label();
- this.lbQualAspectAve = new System.Windows.Forms.Label();
- this.lbEdgeMax = new System.Windows.Forms.Label();
- this.lbQualAlphaAve = new System.Windows.Forms.Label();
- this.lbAreaMax = new System.Windows.Forms.Label();
- this.lbAngleMin = new System.Windows.Forms.Label();
- this.lbQualAspectMin = new System.Windows.Forms.Label();
- this.lbEdgeMin = new System.Windows.Forms.Label();
- this.lbQualAlphaMin = new System.Windows.Forms.Label();
- this.lbAreaMin = new System.Windows.Forms.Label();
- this.label22 = new System.Windows.Forms.Label();
- this.label10 = new System.Windows.Forms.Label();
- this.label17 = new System.Windows.Forms.Label();
- this.label21 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.angleHistogram1 = new MeshExplorer.Controls.AngleHistogram();
+ this.statisticView = new MeshExplorer.Views.StatisticView();
this.tabPage3 = new System.Windows.Forms.TabPage();
- this.lbCodeplex = new System.Windows.Forms.Label();
- this.label15 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.label19 = new System.Windows.Forms.Label();
- this.label18 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.lbShortcuts = new System.Windows.Forms.Label();
+ this.aboutView = new MeshExplorer.Views.AboutView();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuFile = new System.Windows.Forms.ToolStripMenuItem();
this.menuFileOpen = new System.Windows.Forms.ToolStripMenuItem();
@@ -104,10 +55,8 @@
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.menuToolsRcm = new System.Windows.Forms.ToolStripMenuItem();
this.btnMesh = new MeshExplorer.Controls.DarkButton();
- this.renderControl1 = new MeshExplorer.Controls.RendererControl();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
- this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.flatTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@@ -136,7 +85,6 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.Black;
- this.splitContainer1.Panel2.Controls.Add(this.renderControl1);
this.splitContainer1.Size = new System.Drawing.Size(984, 612);
this.splitContainer1.SplitterDistance = 280;
this.splitContainer1.SplitterWidth = 1;
@@ -168,18 +116,7 @@
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.DimGray;
- this.tabPage1.Controls.Add(this.lbMaxArea);
- this.tabPage1.Controls.Add(this.label6);
- this.tabPage1.Controls.Add(this.lbMinAngle);
- this.tabPage1.Controls.Add(this.label23);
- this.tabPage1.Controls.Add(this.label9);
- this.tabPage1.Controls.Add(this.label8);
- this.tabPage1.Controls.Add(this.label5);
- this.tabPage1.Controls.Add(this.slMaxArea);
- this.tabPage1.Controls.Add(this.slMinAngle);
- this.tabPage1.Controls.Add(this.cbConformDel);
- this.tabPage1.Controls.Add(this.cbConvex);
- this.tabPage1.Controls.Add(this.cbQuality);
+ this.tabPage1.Controls.Add(this.meshControlView);
this.tabPage1.ForeColor = System.Drawing.Color.DarkGray;
this.tabPage1.Location = new System.Drawing.Point(4, 4);
this.tabPage1.Name = "tabPage1";
@@ -187,175 +124,20 @@
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Mesh Control";
//
- // lbMaxArea
+ // meshControlView
//
- this.lbMaxArea.AutoSize = true;
- this.lbMaxArea.ForeColor = System.Drawing.Color.White;
- this.lbMaxArea.Location = new System.Drawing.Point(227, 66);
- this.lbMaxArea.Name = "lbMaxArea";
- this.lbMaxArea.Size = new System.Drawing.Size(13, 13);
- this.lbMaxArea.TabIndex = 14;
- this.lbMaxArea.Text = "0";
- //
- // label6
- //
- this.label6.AutoSize = true;
- this.label6.ForeColor = System.Drawing.Color.White;
- this.label6.Location = new System.Drawing.Point(8, 65);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(81, 13);
- this.label6.TabIndex = 14;
- this.label6.Text = "Maximum area";
- //
- // lbMinAngle
- //
- this.lbMinAngle.AutoSize = true;
- this.lbMinAngle.ForeColor = System.Drawing.Color.White;
- this.lbMinAngle.Location = new System.Drawing.Point(227, 44);
- this.lbMinAngle.Name = "lbMinAngle";
- this.lbMinAngle.Size = new System.Drawing.Size(19, 13);
- this.lbMinAngle.TabIndex = 14;
- this.lbMinAngle.Text = "20";
- //
- // label23
- //
- this.label23.BackColor = System.Drawing.Color.DimGray;
- this.label23.ForeColor = System.Drawing.Color.DarkGray;
- this.label23.Location = new System.Drawing.Point(8, 152);
- this.label23.Name = "label23";
- this.label23.Size = new System.Drawing.Size(251, 33);
- this.label23.TabIndex = 14;
- this.label23.Text = "Ensure that all triangles in the mesh are truly Delaunay, and not just constraine" +
- "d Delaunay.";
- //
- // label9
- //
- this.label9.BackColor = System.Drawing.Color.DimGray;
- this.label9.ForeColor = System.Drawing.Color.DarkGray;
- this.label9.Location = new System.Drawing.Point(8, 216);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(258, 33);
- this.label9.TabIndex = 14;
- this.label9.Text = "Use the convex mesh option, if the convex hull should be included in the output.";
- //
- // label8
- //
- this.label8.BackColor = System.Drawing.Color.DimGray;
- this.label8.ForeColor = System.Drawing.Color.DarkGray;
- this.label8.Location = new System.Drawing.Point(8, 89);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(258, 33);
- this.label8.TabIndex = 14;
- this.label8.Text = "Hint: maximum area values of 0 or 1 will be irgnored (no area constraints are set" +
- ").";
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.ForeColor = System.Drawing.Color.White;
- this.label5.Location = new System.Drawing.Point(8, 43);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(87, 13);
- this.label5.TabIndex = 14;
- this.label5.Text = "Minimum angle";
- //
- // slMaxArea
- //
- this.slMaxArea.BackColor = System.Drawing.Color.Transparent;
- this.slMaxArea.CriticalPercent = ((uint)(0u));
- this.slMaxArea.Location = new System.Drawing.Point(102, 62);
- this.slMaxArea.Maximum = 100;
- this.slMaxArea.Minimum = 0;
- this.slMaxArea.Name = "slMaxArea";
- this.slMaxArea.Size = new System.Drawing.Size(119, 18);
- this.slMaxArea.TabIndex = 13;
- this.slMaxArea.Text = "darkSlider1";
- this.slMaxArea.Value = 0;
- this.slMaxArea.ValueChanging += new System.EventHandler(this.slMaxArea_ValueChanging);
- //
- // slMinAngle
- //
- this.slMinAngle.BackColor = System.Drawing.Color.Transparent;
- this.slMinAngle.CriticalPercent = ((uint)(89u));
- this.slMinAngle.Location = new System.Drawing.Point(102, 40);
- this.slMinAngle.Maximum = 100;
- this.slMinAngle.Minimum = 0;
- this.slMinAngle.Name = "slMinAngle";
- this.slMinAngle.Size = new System.Drawing.Size(119, 18);
- this.slMinAngle.TabIndex = 13;
- this.slMinAngle.Text = "darkSlider1";
- this.slMinAngle.Value = 50;
- this.slMinAngle.ValueChanging += new System.EventHandler(this.slMinAngle_ValueChanging);
- //
- // cbConformDel
- //
- this.cbConformDel.BackColor = System.Drawing.Color.DimGray;
- this.cbConformDel.Checked = false;
- this.cbConformDel.Location = new System.Drawing.Point(11, 132);
- this.cbConformDel.Name = "cbConformDel";
- this.cbConformDel.Size = new System.Drawing.Size(142, 17);
- this.cbConformDel.TabIndex = 0;
- this.cbConformDel.Text = "Conforming Delaunay";
- this.cbConformDel.UseVisualStyleBackColor = false;
- //
- // cbConvex
- //
- this.cbConvex.BackColor = System.Drawing.Color.DimGray;
- this.cbConvex.Checked = false;
- this.cbConvex.Location = new System.Drawing.Point(11, 196);
- this.cbConvex.Name = "cbConvex";
- this.cbConvex.Size = new System.Drawing.Size(115, 17);
- this.cbConvex.TabIndex = 0;
- this.cbConvex.Text = "Convex mesh";
- this.cbConvex.UseVisualStyleBackColor = false;
- //
- // cbQuality
- //
- this.cbQuality.BackColor = System.Drawing.Color.DimGray;
- this.cbQuality.Checked = false;
- this.cbQuality.Location = new System.Drawing.Point(11, 17);
- this.cbQuality.Name = "cbQuality";
- this.cbQuality.Size = new System.Drawing.Size(115, 17);
- this.cbQuality.TabIndex = 0;
- this.cbQuality.Text = "Quality mesh";
- this.cbQuality.UseVisualStyleBackColor = false;
+ this.meshControlView.BackColor = System.Drawing.Color.DimGray;
+ this.meshControlView.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.meshControlView.ForeColor = System.Drawing.Color.DarkGray;
+ this.meshControlView.Location = new System.Drawing.Point(0, 0);
+ this.meshControlView.Name = "meshControlView";
+ this.meshControlView.Size = new System.Drawing.Size(272, 509);
+ this.meshControlView.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.BackColor = System.Drawing.Color.DimGray;
- this.tabPage2.Controls.Add(this.label20);
- this.tabPage2.Controls.Add(this.label4);
- this.tabPage2.Controls.Add(this.label3);
- this.tabPage2.Controls.Add(this.label2);
- this.tabPage2.Controls.Add(this.lbNumSeg);
- this.tabPage2.Controls.Add(this.lbNumSeg2);
- this.tabPage2.Controls.Add(this.lbNumTri);
- this.tabPage2.Controls.Add(this.lbNumTri2);
- this.tabPage2.Controls.Add(this.lbNumVert);
- this.tabPage2.Controls.Add(this.lbNumVert2);
- this.tabPage2.Controls.Add(this.label32);
- this.tabPage2.Controls.Add(this.label13);
- this.tabPage2.Controls.Add(this.label31);
- this.tabPage2.Controls.Add(this.label12);
- this.tabPage2.Controls.Add(this.label16);
- this.tabPage2.Controls.Add(this.label29);
- this.tabPage2.Controls.Add(this.label14);
- this.tabPage2.Controls.Add(this.lbAngleMax);
- this.tabPage2.Controls.Add(this.lbQualAspectAve);
- this.tabPage2.Controls.Add(this.lbEdgeMax);
- this.tabPage2.Controls.Add(this.lbQualAlphaAve);
- this.tabPage2.Controls.Add(this.lbAreaMax);
- this.tabPage2.Controls.Add(this.lbAngleMin);
- this.tabPage2.Controls.Add(this.lbQualAspectMin);
- this.tabPage2.Controls.Add(this.lbEdgeMin);
- this.tabPage2.Controls.Add(this.lbQualAlphaMin);
- this.tabPage2.Controls.Add(this.lbAreaMin);
- this.tabPage2.Controls.Add(this.label22);
- this.tabPage2.Controls.Add(this.label10);
- this.tabPage2.Controls.Add(this.label17);
- this.tabPage2.Controls.Add(this.label21);
- this.tabPage2.Controls.Add(this.label11);
- this.tabPage2.Controls.Add(this.angleHistogram1);
+ this.tabPage2.Controls.Add(this.statisticView);
this.tabPage2.ForeColor = System.Drawing.Color.White;
this.tabPage2.Location = new System.Drawing.Point(4, 4);
this.tabPage2.Name = "tabPage2";
@@ -364,350 +146,20 @@
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Statistic";
//
- // label20
- //
- this.label20.AutoSize = true;
- this.label20.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label20.ForeColor = System.Drawing.Color.White;
- this.label20.Location = new System.Drawing.Point(8, 17);
- this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(39, 13);
- this.label20.TabIndex = 26;
- this.label20.Text = "Mesh:";
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.ForeColor = System.Drawing.Color.DarkGray;
- this.label4.Location = new System.Drawing.Point(8, 57);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(60, 13);
- this.label4.TabIndex = 23;
- this.label4.Text = "Segments:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.ForeColor = System.Drawing.Color.DarkGray;
- this.label3.Location = new System.Drawing.Point(8, 76);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(56, 13);
- this.label3.TabIndex = 24;
- this.label3.Text = "Triangles:";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.ForeColor = System.Drawing.Color.DarkGray;
- this.label2.Location = new System.Drawing.Point(8, 38);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(50, 13);
- this.label2.TabIndex = 25;
- this.label2.Text = "Vertices:";
- //
- // lbNumSeg
- //
- this.lbNumSeg.ForeColor = System.Drawing.Color.White;
- this.lbNumSeg.Location = new System.Drawing.Point(98, 57);
- this.lbNumSeg.Name = "lbNumSeg";
- this.lbNumSeg.Size = new System.Drawing.Size(70, 13);
- this.lbNumSeg.TabIndex = 20;
- this.lbNumSeg.Text = "-";
- this.lbNumSeg.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbNumSeg2
- //
- this.lbNumSeg2.ForeColor = System.Drawing.Color.DarkGray;
- this.lbNumSeg2.Location = new System.Drawing.Point(188, 57);
- this.lbNumSeg2.Name = "lbNumSeg2";
- this.lbNumSeg2.Size = new System.Drawing.Size(70, 13);
- this.lbNumSeg2.TabIndex = 19;
- this.lbNumSeg2.Text = "-";
- this.lbNumSeg2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbNumTri
- //
- this.lbNumTri.ForeColor = System.Drawing.Color.White;
- this.lbNumTri.Location = new System.Drawing.Point(98, 76);
- this.lbNumTri.Name = "lbNumTri";
- this.lbNumTri.Size = new System.Drawing.Size(70, 13);
- this.lbNumTri.TabIndex = 17;
- this.lbNumTri.Text = "-";
- this.lbNumTri.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbNumTri2
- //
- this.lbNumTri2.ForeColor = System.Drawing.Color.DarkGray;
- this.lbNumTri2.Location = new System.Drawing.Point(188, 76);
- this.lbNumTri2.Name = "lbNumTri2";
- this.lbNumTri2.Size = new System.Drawing.Size(70, 13);
- this.lbNumTri2.TabIndex = 18;
- this.lbNumTri2.Text = "-";
- this.lbNumTri2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbNumVert
- //
- this.lbNumVert.ForeColor = System.Drawing.Color.White;
- this.lbNumVert.Location = new System.Drawing.Point(98, 38);
- this.lbNumVert.Name = "lbNumVert";
- this.lbNumVert.Size = new System.Drawing.Size(70, 13);
- this.lbNumVert.TabIndex = 21;
- this.lbNumVert.Text = "-";
- this.lbNumVert.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbNumVert2
- //
- this.lbNumVert2.ForeColor = System.Drawing.Color.DarkGray;
- this.lbNumVert2.Location = new System.Drawing.Point(188, 38);
- this.lbNumVert2.Name = "lbNumVert2";
- this.lbNumVert2.Size = new System.Drawing.Size(70, 13);
- this.lbNumVert2.TabIndex = 22;
- this.lbNumVert2.Text = "-";
- this.lbNumVert2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // label32
- //
- this.label32.AutoSize = true;
- this.label32.ForeColor = System.Drawing.Color.DarkGray;
- this.label32.Location = new System.Drawing.Point(210, 213);
- this.label32.Name = "label32";
- this.label32.Size = new System.Drawing.Size(48, 13);
- this.label32.TabIndex = 11;
- this.label32.Text = "Average";
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.ForeColor = System.Drawing.Color.DarkGray;
- this.label13.Location = new System.Drawing.Point(202, 114);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(56, 13);
- this.label13.TabIndex = 11;
- this.label13.Text = "Maximum";
- //
- // label31
- //
- this.label31.AutoSize = true;
- this.label31.ForeColor = System.Drawing.Color.DarkGray;
- this.label31.Location = new System.Drawing.Point(112, 213);
- this.label31.Name = "label31";
- this.label31.Size = new System.Drawing.Size(55, 13);
- this.label31.TabIndex = 12;
- this.label31.Text = "Minimum";
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.ForeColor = System.Drawing.Color.DarkGray;
- this.label12.Location = new System.Drawing.Point(113, 114);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(55, 13);
- this.label12.TabIndex = 12;
- this.label12.Text = "Minimum";
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.ForeColor = System.Drawing.Color.DarkGray;
- this.label16.Location = new System.Drawing.Point(8, 173);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(40, 13);
- this.label16.TabIndex = 9;
- this.label16.Text = "Angle:";
- //
- // label29
- //
- this.label29.AutoSize = true;
- this.label29.ForeColor = System.Drawing.Color.DarkGray;
- this.label29.Location = new System.Drawing.Point(8, 253);
- this.label29.Name = "label29";
- this.label29.Size = new System.Drawing.Size(71, 13);
- this.label29.TabIndex = 15;
- this.label29.Text = "Aspect ratio:";
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.ForeColor = System.Drawing.Color.DarkGray;
- this.label14.Location = new System.Drawing.Point(8, 154);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(73, 13);
- this.label14.TabIndex = 15;
- this.label14.Text = "Edge length:";
- //
- // lbAngleMax
- //
- this.lbAngleMax.ForeColor = System.Drawing.Color.White;
- this.lbAngleMax.Location = new System.Drawing.Point(182, 173);
- this.lbAngleMax.Name = "lbAngleMax";
- this.lbAngleMax.Size = new System.Drawing.Size(76, 13);
- this.lbAngleMax.TabIndex = 16;
- this.lbAngleMax.Text = "-";
- this.lbAngleMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbQualAspectAve
- //
- this.lbQualAspectAve.ForeColor = System.Drawing.Color.White;
- this.lbQualAspectAve.Location = new System.Drawing.Point(182, 253);
- this.lbQualAspectAve.Name = "lbQualAspectAve";
- this.lbQualAspectAve.Size = new System.Drawing.Size(76, 13);
- this.lbQualAspectAve.TabIndex = 14;
- this.lbQualAspectAve.Text = "-";
- this.lbQualAspectAve.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbEdgeMax
- //
- this.lbEdgeMax.ForeColor = System.Drawing.Color.White;
- this.lbEdgeMax.Location = new System.Drawing.Point(182, 154);
- this.lbEdgeMax.Name = "lbEdgeMax";
- this.lbEdgeMax.Size = new System.Drawing.Size(76, 13);
- this.lbEdgeMax.TabIndex = 14;
- this.lbEdgeMax.Text = "-";
- this.lbEdgeMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbQualAlphaAve
- //
- this.lbQualAlphaAve.ForeColor = System.Drawing.Color.White;
- this.lbQualAlphaAve.Location = new System.Drawing.Point(182, 234);
- this.lbQualAlphaAve.Name = "lbQualAlphaAve";
- this.lbQualAlphaAve.Size = new System.Drawing.Size(76, 13);
- this.lbQualAlphaAve.TabIndex = 3;
- this.lbQualAlphaAve.Text = "-";
- this.lbQualAlphaAve.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbAreaMax
- //
- this.lbAreaMax.ForeColor = System.Drawing.Color.White;
- this.lbAreaMax.Location = new System.Drawing.Point(182, 135);
- this.lbAreaMax.Name = "lbAreaMax";
- this.lbAreaMax.Size = new System.Drawing.Size(76, 13);
- this.lbAreaMax.TabIndex = 3;
- this.lbAreaMax.Text = "-";
- this.lbAreaMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbAngleMin
- //
- this.lbAngleMin.ForeColor = System.Drawing.Color.White;
- this.lbAngleMin.Location = new System.Drawing.Point(100, 173);
- this.lbAngleMin.Name = "lbAngleMin";
- this.lbAngleMin.Size = new System.Drawing.Size(68, 13);
- this.lbAngleMin.TabIndex = 4;
- this.lbAngleMin.Text = "-";
- this.lbAngleMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbQualAspectMin
- //
- this.lbQualAspectMin.ForeColor = System.Drawing.Color.White;
- this.lbQualAspectMin.Location = new System.Drawing.Point(100, 253);
- this.lbQualAspectMin.Name = "lbQualAspectMin";
- this.lbQualAspectMin.Size = new System.Drawing.Size(68, 13);
- this.lbQualAspectMin.TabIndex = 2;
- this.lbQualAspectMin.Text = "-";
- this.lbQualAspectMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbEdgeMin
- //
- this.lbEdgeMin.ForeColor = System.Drawing.Color.White;
- this.lbEdgeMin.Location = new System.Drawing.Point(100, 154);
- this.lbEdgeMin.Name = "lbEdgeMin";
- this.lbEdgeMin.Size = new System.Drawing.Size(68, 13);
- this.lbEdgeMin.TabIndex = 2;
- this.lbEdgeMin.Text = "-";
- this.lbEdgeMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbQualAlphaMin
- //
- this.lbQualAlphaMin.ForeColor = System.Drawing.Color.White;
- this.lbQualAlphaMin.Location = new System.Drawing.Point(100, 234);
- this.lbQualAlphaMin.Name = "lbQualAlphaMin";
- this.lbQualAlphaMin.Size = new System.Drawing.Size(68, 13);
- this.lbQualAlphaMin.TabIndex = 7;
- this.lbQualAlphaMin.Text = "-";
- this.lbQualAlphaMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // lbAreaMin
- //
- this.lbAreaMin.ForeColor = System.Drawing.Color.White;
- this.lbAreaMin.Location = new System.Drawing.Point(100, 135);
- this.lbAreaMin.Name = "lbAreaMin";
- this.lbAreaMin.Size = new System.Drawing.Size(68, 13);
- this.lbAreaMin.TabIndex = 7;
- this.lbAreaMin.Text = "-";
- this.lbAreaMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
- //
- // label22
- //
- this.label22.AutoSize = true;
- this.label22.ForeColor = System.Drawing.Color.DarkGray;
- this.label22.Location = new System.Drawing.Point(8, 234);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(65, 13);
- this.label22.TabIndex = 8;
- this.label22.Text = "Min. angle:";
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.ForeColor = System.Drawing.Color.DarkGray;
- this.label10.Location = new System.Drawing.Point(8, 135);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(76, 13);
- this.label10.TabIndex = 8;
- this.label10.Text = "Triangle area:";
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label17.ForeColor = System.Drawing.Color.White;
- this.label17.Location = new System.Drawing.Point(8, 290);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(97, 13);
- this.label17.TabIndex = 5;
- this.label17.Text = "Angle histogram:";
- //
- // label21
- //
- this.label21.AutoSize = true;
- this.label21.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label21.ForeColor = System.Drawing.Color.White;
- this.label21.Location = new System.Drawing.Point(8, 213);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(47, 13);
- this.label21.TabIndex = 6;
- this.label21.Text = "Quality:";
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label11.ForeColor = System.Drawing.Color.White;
- this.label11.Location = new System.Drawing.Point(8, 114);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(50, 13);
- this.label11.TabIndex = 6;
- this.label11.Text = "Statistic:";
- //
- // angleHistogram1
- //
- this.angleHistogram1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(76)))), ((int)(((byte)(76)))));
- this.angleHistogram1.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.angleHistogram1.Location = new System.Drawing.Point(6, 308);
- this.angleHistogram1.Name = "angleHistogram1";
- this.angleHistogram1.Size = new System.Drawing.Size(260, 195);
- this.angleHistogram1.TabIndex = 0;
- this.angleHistogram1.Text = "angleHistogram1";
+ // statisticView
+ //
+ this.statisticView.BackColor = System.Drawing.Color.DimGray;
+ this.statisticView.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.statisticView.ForeColor = System.Drawing.Color.DarkGray;
+ this.statisticView.Location = new System.Drawing.Point(0, 0);
+ this.statisticView.Name = "statisticView";
+ this.statisticView.Size = new System.Drawing.Size(272, 509);
+ this.statisticView.TabIndex = 0;
//
// tabPage3
//
this.tabPage3.BackColor = System.Drawing.Color.DimGray;
- this.tabPage3.Controls.Add(this.lbCodeplex);
- this.tabPage3.Controls.Add(this.label15);
- this.tabPage3.Controls.Add(this.label1);
- this.tabPage3.Controls.Add(this.label19);
- this.tabPage3.Controls.Add(this.label18);
- this.tabPage3.Controls.Add(this.label7);
- this.tabPage3.Controls.Add(this.lbShortcuts);
+ this.tabPage3.Controls.Add(this.aboutView);
this.tabPage3.Location = new System.Drawing.Point(4, 4);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
@@ -715,79 +167,15 @@
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "About";
//
- // lbCodeplex
+ // aboutView
//
- this.lbCodeplex.AutoSize = true;
- this.lbCodeplex.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbCodeplex.ForeColor = System.Drawing.Color.White;
- this.lbCodeplex.Location = new System.Drawing.Point(70, 82);
- this.lbCodeplex.Name = "lbCodeplex";
- this.lbCodeplex.Size = new System.Drawing.Size(153, 13);
- this.lbCodeplex.TabIndex = 2;
- this.lbCodeplex.Text = "http://triangle.codeplex.com";
- this.lbCodeplex.Click += new System.EventHandler(this.lbCodeplex_Clicked);
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label15.ForeColor = System.Drawing.Color.White;
- this.label15.Location = new System.Drawing.Point(8, 17);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(73, 13);
- this.label15.TabIndex = 1;
- this.label15.Text = "Triangle.NET";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.ForeColor = System.Drawing.Color.White;
- this.label1.Location = new System.Drawing.Point(8, 132);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(108, 13);
- this.label1.TabIndex = 1;
- this.label1.Text = "Keyboard shortcuts";
- //
- // label19
- //
- this.label19.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label19.ForeColor = System.Drawing.Color.White;
- this.label19.Location = new System.Drawing.Point(70, 42);
- this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(134, 40);
- this.label19.TabIndex = 0;
- this.label19.Text = "Beta 2 (2012-07-30)\r\nChristian Woltering\r\nMIT";
- //
- // label18
- //
- this.label18.ForeColor = System.Drawing.Color.White;
- this.label18.Location = new System.Drawing.Point(13, 42);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(51, 40);
- this.label18.TabIndex = 0;
- this.label18.Text = "Version:\r\nAuthor:\r\nLicense:";
- this.label18.TextAlign = System.Drawing.ContentAlignment.TopRight;
- //
- // label7
- //
- this.label7.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label7.ForeColor = System.Drawing.Color.White;
- this.label7.Location = new System.Drawing.Point(70, 155);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(134, 108);
- this.label7.TabIndex = 0;
- this.label7.Text = "File Open\r\nFile Save\r\nReload Input\r\n\r\nTriangulate / Refine\r\nSmooth\r\n\r\nShow Log";
- //
- // lbShortcuts
- //
- this.lbShortcuts.ForeColor = System.Drawing.Color.White;
- this.lbShortcuts.Location = new System.Drawing.Point(22, 155);
- this.lbShortcuts.Name = "lbShortcuts";
- this.lbShortcuts.Size = new System.Drawing.Size(36, 108);
- this.lbShortcuts.TabIndex = 0;
- this.lbShortcuts.Text = "F3\r\nF4\r\nF5\r\n\r\nF8\r\nF9\r\n\r\nF12";
- this.lbShortcuts.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ this.aboutView.BackColor = System.Drawing.Color.DimGray;
+ this.aboutView.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.aboutView.ForeColor = System.Drawing.Color.DarkGray;
+ this.aboutView.Location = new System.Drawing.Point(0, 0);
+ this.aboutView.Name = "aboutView";
+ this.aboutView.Size = new System.Drawing.Size(272, 509);
+ this.aboutView.TabIndex = 0;
//
// menuStrip1
//
@@ -925,6 +313,7 @@
//
// menuToolsRcm
//
+ this.menuToolsRcm.Enabled = false;
this.menuToolsRcm.Name = "menuToolsRcm";
this.menuToolsRcm.Size = new System.Drawing.Size(195, 22);
this.menuToolsRcm.Text = "Renumber nodes (RCM)";
@@ -941,20 +330,9 @@
this.btnMesh.UseVisualStyleBackColor = true;
this.btnMesh.Click += new System.EventHandler(this.btnMesh_Click);
//
- // renderControl1
- //
- this.renderControl1.BackColor = System.Drawing.Color.Black;
- this.renderControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.renderControl1.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.renderControl1.Location = new System.Drawing.Point(0, 0);
- this.renderControl1.Name = "renderControl1";
- this.renderControl1.ShowVoronoi = false;
- this.renderControl1.Size = new System.Drawing.Size(703, 612);
- this.renderControl1.TabIndex = 0;
- this.renderControl1.Text = "meshRenderer1";
- //
// FormMain
//
+ this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(76)))), ((int)(((byte)(76)))));
@@ -969,20 +347,18 @@
this.Load += new System.EventHandler(this.Form1_Load);
this.ResizeBegin += new System.EventHandler(this.ResizeBeginHandler);
this.ResizeEnd += new System.EventHandler(this.ResizeEndHandler);
+ this.DragDrop += new System.Windows.Forms.DragEventHandler(this.frmDragDrop);
+ this.DragOver += new System.Windows.Forms.DragEventHandler(this.frmDragOver);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
this.Resize += new System.EventHandler(this.ResizeHandler);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
- this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.flatTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
- this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
- this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
- this.tabPage3.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
@@ -992,7 +368,6 @@
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
- private Controls.RendererControl renderControl1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem menuFile;
private System.Windows.Forms.ToolStripMenuItem menuFileOpen;
@@ -1002,34 +377,7 @@
private System.Windows.Forms.TabPage tabPage2;
private Controls.DarkButton btnSmooth;
private Controls.DarkButton btnMesh;
- private Controls.DarkCheckBox cbQuality;
- private Controls.AngleHistogram angleHistogram1;
- private Controls.DarkSlider slMinAngle;
private System.Windows.Forms.TabPage tabPage3;
- private System.Windows.Forms.Label lbShortcuts;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label7;
- private Controls.DarkCheckBox cbConvex;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label5;
- private Controls.DarkSlider slMaxArea;
- private System.Windows.Forms.Label lbMaxArea;
- private System.Windows.Forms.Label lbMinAngle;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.Label label16;
- private System.Windows.Forms.Label label14;
- private System.Windows.Forms.Label lbAngleMax;
- private System.Windows.Forms.Label lbEdgeMax;
- private System.Windows.Forms.Label lbAreaMax;
- private System.Windows.Forms.Label lbAngleMin;
- private System.Windows.Forms.Label lbEdgeMin;
- private System.Windows.Forms.Label lbAreaMin;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label17;
- private System.Windows.Forms.Label label11;
private System.Windows.Forms.ToolStripMenuItem menuView;
private System.Windows.Forms.ToolStripMenuItem menuViewVoronoi;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
@@ -1039,35 +387,13 @@
private System.Windows.Forms.ToolStripMenuItem menuToolsCheck;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem menuFileQuit;
- private System.Windows.Forms.Label label15;
- private System.Windows.Forms.Label label19;
- private System.Windows.Forms.Label label18;
- private System.Windows.Forms.Label lbCodeplex;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripMenuItem menuFileExport;
- private System.Windows.Forms.Label label32;
- private System.Windows.Forms.Label label31;
- private System.Windows.Forms.Label label29;
- private System.Windows.Forms.Label lbQualAspectAve;
- private System.Windows.Forms.Label lbQualAlphaAve;
- private System.Windows.Forms.Label lbQualAspectMin;
- private System.Windows.Forms.Label lbQualAlphaMin;
- private System.Windows.Forms.Label label22;
- private System.Windows.Forms.Label label21;
- private System.Windows.Forms.Label label20;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label lbNumSeg;
- private System.Windows.Forms.Label lbNumSeg2;
- private System.Windows.Forms.Label lbNumTri;
- private System.Windows.Forms.Label lbNumTri2;
- private System.Windows.Forms.Label lbNumVert;
- private System.Windows.Forms.Label lbNumVert2;
- private System.Windows.Forms.Label label23;
- private Controls.DarkCheckBox cbConformDel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem menuToolsRcm;
+ private Views.MeshControlView meshControlView;
+ private Views.StatisticView statisticView;
+ private Views.AboutView aboutView;
}
}
diff --git a/Triangle.NET/TestApp/FormMain.cs b/Triangle.NET/TestApp/FormMain.cs
index 66043b5..4fdc11b 100644
--- a/Triangle.NET/TestApp/FormMain.cs
+++ b/Triangle.NET/TestApp/FormMain.cs
@@ -2,14 +2,13 @@
using System.Diagnostics;
using System.Drawing;
using System.IO;
-using System.Linq;
using System.Windows.Forms;
using MeshExplorer.Controls;
using MeshExplorer.IO;
+using MeshRenderer.Core;
using TriangleNet;
using TriangleNet.Geometry;
using TriangleNet.Tools;
-using MeshExplorer.Rendering;
namespace MeshExplorer
{
@@ -18,12 +17,13 @@ namespace MeshExplorer
Settings settings;
InputGeometry input;
Mesh mesh;
- Statistic stats;
- QualityMeasure quality;
FormLog frmLog;
FormGenerator frmGenerator;
+ RenderManager renderManager;
+ RenderData renderData;
+
public FormMain()
{
InitializeComponent();
@@ -37,9 +37,47 @@ namespace MeshExplorer
settings = new Settings();
- renderControl1.Initialize();
+ renderManager = new RenderManager();
+ renderManager.CreateDefaultControl();
- stats = new Statistic();
+ /*
+ if (!renderManager.CreateControl("MeshRenderer.SharpGL2.dll", new string[] { "SharpGL.dll" }))
+ {
+ renderManager.CreateDefaultControl();
+
+ if (frmLog == null)
+ {
+ frmLog = new FormLog();
+ }
+
+ frmLog.AddItem("Failed to initialize OpenGL.", true);
+ }
+ */
+
+ var control = renderManager.RenderControl;
+
+ if (control != null)
+ {
+ this.splitContainer1.Panel2.Controls.Add(control);
+
+ // Initialize control
+ control.BackColor = Color.Black;
+ control.Dock = DockStyle.Fill;
+ control.Font = new Font("Consolas", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
+ control.Location = new System.Drawing.Point(0, 0);
+ control.Name = "renderControl1";
+ control.Size = new Size(703, 612);
+ control.TabIndex = 0;
+ control.Text = "meshRenderer1";
+
+ renderManager.Initialize();
+ }
+ else
+ {
+ DarkMessageBox.Show("Ooops ...", "Failed to initialize renderer.");
+ }
+
+ renderData = new RenderData();
}
private void Form1_KeyUp(object sender, KeyEventArgs e)
@@ -47,7 +85,7 @@ namespace MeshExplorer
switch (e.KeyCode)
{
case Keys.F3:
- Open();
+ OpenWithDialog();
break;
case Keys.F4:
Save();
@@ -88,39 +126,57 @@ namespace MeshExplorer
Smooth();
}
- private void lbCodeplex_Clicked(object sender, EventArgs e)
+ #region Drag and drop
+
+ private void frmDragDrop(object sender, DragEventArgs e)
{
- try
+ if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
- ProcessStartInfo sInfo = new ProcessStartInfo("http://triangle.codeplex.com/");
- Process.Start(sInfo);
+ string[] args = (string[])e.Data.GetData(DataFormats.FileDrop);
+
+ Open(args[0]);
}
- catch (Exception)
- { }
}
- private void slMinAngle_ValueChanging(object sender, EventArgs e)
+ private void frmDragOver(object sender, DragEventArgs e)
{
- // Between 0 and 40 (step 1)
- int angle = (slMinAngle.Value * 40) / 100;
- lbMinAngle.Text = angle.ToString();
+ if (e.Data.GetDataPresent(DataFormats.FileDrop))
+ {
+ string[] args = (string[])e.Data.GetData(DataFormats.FileDrop);
+
+ if (args.Length > 1)
+ {
+ e.Effect = DragDropEffects.None;
+ return;
+ }
+
+ string file = args[0].ToLower();
+
+ // Check if file extension is known
+ if (FileProcessor.CanHandleFile(file))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
}
- private void slMaxArea_ValueChanging(object sender, EventArgs e)
- {
- // Between 0 and 1 (step 0.01)
- double area = slMaxArea.Value * 0.01;
- lbMaxArea.Text = area.ToString(Util.Nfi);
- }
+ #endregion
protected override void OnMouseWheel(MouseEventArgs e)
{
+ var container = this.splitContainer1.Panel2.ClientRectangle;
+
System.Drawing.Point pt = e.Location;
pt.Offset(-splitContainer1.SplitterDistance, 0);
- if (renderControl1.ClientRectangle.Contains(pt))
+ if (container.Contains(pt))
{
- renderControl1.Zoom(pt, e.Delta);
+ renderManager.Zoom(((float)pt.X) / container.Width,
+ ((float)pt.Y) / container.Height, e.Delta);
}
base.OnMouseWheel(e);
}
@@ -135,7 +191,7 @@ namespace MeshExplorer
// Handle window minimize and maximize
if (!isResizing)
{
- renderControl1.HandleResize();
+ renderManager.HandleResize();
}
}
@@ -146,7 +202,7 @@ namespace MeshExplorer
if (this.ClientSize != this.oldClientSize)
{
this.oldClientSize = this.ClientSize;
- renderControl1.HandleResize();
+ renderManager.HandleResize();
}
}
@@ -168,132 +224,45 @@ namespace MeshExplorer
settings.RefineMode = false;
settings.ExceptionThrown = false;
- // Reset labels
- lbNumVert2.Text = "-";
- lbNumTri2.Text = "-";
- lbNumSeg2.Text = "-";
-
- lbNumVert.Text = input.Count.ToString();
- lbNumSeg.Text = input.Segments.Count().ToString();
- lbNumTri.Text = "0"; //input.Triangles == null ? "0" : input.Triangles.Length.ToString();
-
- // Statistics labels
- lbAreaMin.Text = "-";
- lbAreaMax.Text = "-";
- lbEdgeMin.Text = "-";
- lbEdgeMax.Text = "-";
- lbAngleMin.Text = "-";
- lbAngleMax.Text = "-";
-
- // Quality labels
- lbQualAlphaMin.Text = "-";
- lbQualAlphaAve.Text = "-";
- lbQualAspectMin.Text = "-";
- lbQualAspectAve.Text = "-";
-
- angleHistogram1.SetData(null, null);
-
// Reset buttons
btnMesh.Enabled = true;
btnMesh.Text = "Triangulate";
btnSmooth.Enabled = false;
+ // Update Statistic view
+ statisticView.HandleNewInput(input);
+
// Clear voronoi
menuViewVoronoi.Checked = false;
- renderControl1.ShowVoronoi = false;
+ //renderManager.ShowVoronoi = false;
// Disable menu items
menuFileSave.Enabled = false;
menuFileExport.Enabled = false;
menuViewVoronoi.Enabled = false;
menuToolsCheck.Enabled = false;
+ menuToolsRcm.Enabled = false;
// Render input
- renderControl1.SetData(input);
+ renderData.SetInputGeometry(input);
+ renderManager.SetData(renderData);
// Update window caption
this.Text = "Triangle.NET - Mesh Explorer - " + settings.CurrentFile;
}
- private void HandleMeshChange()
- {
- // Render mesh
- renderControl1.SetData(mesh);
-
- // Previous mesh stats
- lbNumVert2.Text = lbNumVert.Text;
- lbNumTri2.Text = lbNumTri.Text;
- lbNumSeg2.Text = lbNumSeg.Text;
-
- // New mesh stats
- lbNumVert.Text = stats.Vertices.ToString();
- lbNumSeg.Text = stats.ConstrainedEdges.ToString();
- lbNumTri.Text = stats.Triangles.ToString();
-
- // Update statistics tab
- angleHistogram1.SetData(stats.MinAngleHistogram, stats.MaxAngleHistogram);
-
- lbAreaMin.Text = Util.DoubleToString(stats.SmallestArea);
- lbAreaMax.Text = Util.DoubleToString(stats.LargestArea);
- lbEdgeMin.Text = Util.DoubleToString(stats.ShortestEdge);
- lbEdgeMax.Text = Util.DoubleToString(stats.LongestEdge);
- lbAngleMin.Text = Util.AngleToString(stats.SmallestAngle);
- lbAngleMax.Text = Util.AngleToString(stats.LargestAngle);
-
- // Enable menu items
- menuFileSave.Enabled = true;
- menuFileExport.Enabled = true;
- menuViewVoronoi.Enabled = true;
- menuToolsCheck.Enabled = true;
-
- // Update quality
- if (quality == null)
- {
- quality = new QualityMeasure();
- }
-
- quality.Update(this.mesh);
-
- lbQualAlphaMin.Text = Util.DoubleToString(quality.AlphaMinimum);
- lbQualAlphaAve.Text = Util.DoubleToString(quality.AlphaAverage);
-
- lbQualAspectMin.Text = Util.DoubleToString(quality.Q_Minimum);
- lbQualAspectAve.Text = Util.DoubleToString(quality.Q_Average);
- }
-
private void HandleMeshImport()
{
// Render mesh
- renderControl1.SetData(mesh, true);
+ renderData.SetMesh(mesh);
+ renderManager.SetData(renderData);
+ //renderManager.Initialize();
// Update window caption
this.Text = "Triangle.NET - Mesh Explorer - " + settings.CurrentFile;
- // Previous mesh stats
- lbNumVert2.Text = "-";
- lbNumTri2.Text = "-";
- lbNumSeg2.Text = "-";
-
- // New mesh stats
- lbNumVert.Text = stats.Vertices.ToString();
- lbNumSeg.Text = stats.ConstrainedEdges.ToString();
- lbNumTri.Text = stats.Triangles.ToString();
-
- // Update statistics tab
- angleHistogram1.SetData(stats.MinAngleHistogram, stats.MaxAngleHistogram);
-
- lbAreaMin.Text = Util.DoubleToString(stats.SmallestArea);
- lbAreaMax.Text = Util.DoubleToString(stats.LargestArea);
- lbEdgeMin.Text = Util.DoubleToString(stats.ShortestEdge);
- lbEdgeMax.Text = Util.DoubleToString(stats.LongestEdge);
- lbAngleMin.Text = Util.AngleToString(stats.SmallestAngle);
- lbAngleMax.Text = Util.AngleToString(stats.LargestAngle);
-
- // Enable menu items
- menuFileSave.Enabled = true;
- menuFileExport.Enabled = true;
- menuViewVoronoi.Enabled = true;
- menuToolsCheck.Enabled = true;
+ // Update Statistic view
+ statisticView.HandleMeshImport(input, mesh);
// Set refine mode
btnMesh.Enabled = true;
@@ -301,26 +270,39 @@ namespace MeshExplorer
settings.RefineMode = true;
- // Update quality
- if (quality == null)
- {
- quality = new QualityMeasure();
- }
+ HandleMeshChange();
+ }
- quality.Update(this.mesh);
+ private void HandleMeshUpdate()
+ {
+ // Render mesh
+ renderData.SetMesh(mesh);
+ renderManager.SetData(renderData);
- lbQualAlphaMin.Text = Util.DoubleToString(quality.AlphaMinimum);
- lbQualAlphaAve.Text = Util.DoubleToString(quality.AlphaAverage);
+ // Update Statistic view
+ statisticView.HandleMeshUpdate(mesh);
- lbQualAspectMin.Text = Util.DoubleToString(quality.Q_Minimum);
- lbQualAspectAve.Text = Util.DoubleToString(quality.Q_Average);
+ HandleMeshChange();
+ }
+
+ private void HandleMeshChange()
+ {
+ // Update Statistic view
+ statisticView.HandleMeshChange(mesh);
+
+ // Enable menu items
+ menuFileSave.Enabled = true;
+ menuFileExport.Enabled = true;
+ menuViewVoronoi.Enabled = true;
+ menuToolsCheck.Enabled = true;
+ menuToolsRcm.Enabled = true;
}
#endregion
#region Commands
- private void Open()
+ private void OpenWithDialog()
{
OpenFileDialog ofd = new OpenFileDialog();
@@ -331,51 +313,55 @@ namespace MeshExplorer
if (ofd.ShowDialog() == DialogResult.OK)
{
- if (FileProcessor.ContainsMeshData(ofd.FileName))
+ if (Open(ofd.FileName))
{
- if (DarkMessageBox.Show("Import mesh", Settings.ImportString,
- "Do you want to import the mesh?", MessageBoxButtons.YesNo) == DialogResult.OK)
- {
- input = null;
- mesh = FileProcessor.Import(ofd.FileName);
-
- if (mesh != null)
- {
- stats.Update(mesh, 10);
-
- // Update settings
- settings.CurrentFile = Path.GetFileName(ofd.FileName);
-
- HandleMeshImport();
- btnSmooth.Enabled = true; // TODO: Remove
- }
- // else Message
-
- // Update folder settings
- settings.OfdFilterIndex = ofd.FilterIndex;
- settings.OfdDirectory = Path.GetDirectoryName(ofd.FileName);
-
- return;
- }
+ // Update folder settings
+ settings.OfdFilterIndex = ofd.FilterIndex;
+ settings.OfdDirectory = Path.GetDirectoryName(ofd.FileName);
}
-
- input = FileProcessor.Read(ofd.FileName);
-
- if (input != null)
- {
- // Update settings
- settings.CurrentFile = Path.GetFileName(ofd.FileName);
-
- HandleNewInput();
- }
- // else Message
-
- // Update folder settings
- settings.OfdFilterIndex = ofd.FilterIndex;
- settings.OfdDirectory = Path.GetDirectoryName(ofd.FileName);
}
}
+ private bool Open(string filename)
+ {
+ if (FileProcessor.ContainsMeshData(filename))
+ {
+ if (DarkMessageBox.Show("Import mesh", Settings.ImportString,
+ "Do you want to import the mesh?", MessageBoxButtons.YesNo) == DialogResult.OK)
+ {
+ input = null;
+ mesh = FileProcessor.Import(filename);
+
+ if (mesh != null)
+ {
+ statisticView.UpdateStatistic(mesh);
+
+ // Update settings
+ settings.CurrentFile = Path.GetFileName(filename);
+
+ HandleMeshImport();
+ btnSmooth.Enabled = true; // TODO: Remove
+ }
+ // else Message
+
+ return true;
+ }
+ }
+
+ input = FileProcessor.Read(filename);
+
+ if (input != null)
+ {
+ // Update settings
+ settings.CurrentFile = Path.GetFileName(filename);
+
+ HandleNewInput();
+ }
+ // else Message
+
+ return true;
+ }
+
private void Save()
{
SaveFileDialog sfd = new SaveFileDialog();
@@ -414,13 +400,13 @@ namespace MeshExplorer
{
Triangulate();
- if (cbQuality.Checked)
+ if (meshControlView.ParamQualityChecked)
{
btnMesh.Text = "Refine";
- //btnSmooth.Enabled = true;
+ btnSmooth.Enabled = true;
}
}
- else if (cbQuality.Checked)
+ else if (meshControlView.ParamQualityChecked)
{
Refine();
}
@@ -434,17 +420,16 @@ namespace MeshExplorer
mesh = new Mesh();
- if (cbConformDel.Checked)
+ if (meshControlView.ParamConformDelChecked)
{
mesh.SetOption(Options.ConformingDelaunay, true);
}
- if (cbQuality.Checked)
+ if (meshControlView.ParamQualityChecked)
{
mesh.SetOption(Options.Quality, true);
- int angle = (slMinAngle.Value * 40) / 100;
- mesh.SetOption(Options.MinAngle, angle);
+ mesh.SetOption(Options.MinAngle, meshControlView.ParamMinAngleValue);
// Ignore area constraints on initial triangulation.
@@ -457,7 +442,7 @@ namespace MeshExplorer
//}
}
- if (cbConvex.Checked)
+ if (meshControlView.ParamConvexChecked)
{
mesh.SetOption(Options.Convex, true);
}
@@ -468,11 +453,11 @@ namespace MeshExplorer
mesh.Triangulate(input);
//sw.Stop();
- stats.Update(mesh, 10);
+ statisticView.UpdateStatistic(mesh);
- HandleMeshChange();
+ HandleMeshUpdate();
- if (cbQuality.Checked)
+ if (meshControlView.ParamQualityChecked)
{
settings.RefineMode = true;
}
@@ -492,15 +477,14 @@ namespace MeshExplorer
Stopwatch sw = new Stopwatch();
- double area = slMaxArea.Value * 0.01;
+ double area = meshControlView.ParamMaxAreaValue;
if (area > 0 && area < 1)
{
- mesh.SetOption(Options.MaxArea, area * stats.LargestArea);
+ mesh.SetOption(Options.MaxArea, area * statisticView.Statistic.LargestArea);
}
- int angle = (slMinAngle.Value * 40) / 100;
- mesh.SetOption(Options.MinAngle, angle);
+ mesh.SetOption(Options.MinAngle, meshControlView.ParamMinAngleValue);
try
{
@@ -508,9 +492,9 @@ namespace MeshExplorer
mesh.Refine();
sw.Stop();
- stats.Update(mesh, 10);
+ statisticView.UpdateStatistic(mesh);
- HandleMeshChange();
+ HandleMeshUpdate();
}
catch (Exception ex)
{
@@ -546,7 +530,7 @@ namespace MeshExplorer
mesh.Smooth();
sw.Stop();
- stats.Update(mesh, 10);
+ statisticView.UpdateStatistic(mesh);
HandleMeshChange();
}
@@ -588,7 +572,7 @@ namespace MeshExplorer
private void menuFileOpen_Click(object sender, EventArgs e)
{
- Open();
+ OpenWithDialog();
}
private void menuFileSave_Click(object sender, EventArgs ev)
@@ -599,6 +583,59 @@ namespace MeshExplorer
}
}
+ private void menuFileExport_Click(object sender, EventArgs e)
+ {
+ if (mesh != null)
+ {
+ FormExport export = new FormExport();
+
+ string file = settings.OfdDirectory;
+
+ if (!file.EndsWith("\\"))
+ {
+ file += "\\";
+ }
+
+ file += settings.CurrentFile;
+
+ export.ImageName = Path.ChangeExtension(file, ".png");
+
+ if (export.ShowDialog() == DialogResult.OK)
+ {
+ int format = export.ImageFormat;
+ int size = export.ImageSize;
+
+ if (format == 1)
+ {
+ EpsImage eps = new EpsImage();
+ eps.Export(this.mesh, export.ImageName, size);
+ }
+ else if (format == 2)
+ {
+ SvgImage svg = new SvgImage();
+ svg.Export(this.mesh, export.ImageName, size);
+ }
+ else
+ {
+ RasterImage img = new RasterImage();
+ img.ColorScheme = ColorManager.LightScheme();
+ img.Export(this.mesh, export.ImageName, size);
+ }
+ }
+ }
+ }
+
+ private void menuFileQuit_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+ private void menuViewVoronoi_Click(object sender, EventArgs e)
+ {
+ menuViewVoronoi.Checked = !menuViewVoronoi.Checked;
+ //renderControl1.ShowVoronoi = menuViewVoronoi.Checked;
+ }
+
private void menuViewLog_Click(object sender, EventArgs e)
{
ShowLog();
@@ -636,64 +673,11 @@ namespace MeshExplorer
}
}
- private void menuFileExport_Click(object sender, EventArgs e)
- {
- if (mesh != null)
- {
- FormExport export = new FormExport();
-
- string file = settings.OfdDirectory;
-
- if (!file.EndsWith("\\"))
- {
- file += "\\";
- }
-
- file += settings.CurrentFile;
-
- export.ImageName = Path.ChangeExtension(file, ".png");
-
- if (export.ShowDialog() == DialogResult.OK)
- {
- int format = export.ImageFormat;
- int size = export.ImageSize;
-
- if (format == 1)
- {
- EpsImage eps = new EpsImage();
- eps.Export(this.mesh, export.ImageName, size);
- }
- else if (format == 2)
- {
- SvgImage svg = new SvgImage();
- svg.Export(this.mesh, export.ImageName, size);
- }
- else
- {
- RasterImage img = new RasterImage();
- img.ColorScheme = RenderColors.LightScheme();
- img.Export(this.mesh, export.ImageName, size);
- }
- }
- }
- }
-
- private void menuViewVoronoi_Click(object sender, EventArgs e)
- {
- menuViewVoronoi.Checked = !menuViewVoronoi.Checked;
- renderControl1.ShowVoronoi = menuViewVoronoi.Checked;
- }
-
- #endregion
-
- private void menuFileQuit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
-
private void menuToolsRcm_Click(object sender, EventArgs e)
{
Renumber();
}
+
+ #endregion
}
}
diff --git a/Triangle.NET/TestApp/Generators/RandomPointsCircle.cs b/Triangle.NET/TestApp/Generators/RandomPointsCircle.cs
index 8abfa4d..40f4a95 100644
--- a/Triangle.NET/TestApp/Generators/RandomPointsCircle.cs
+++ b/Triangle.NET/TestApp/Generators/RandomPointsCircle.cs
@@ -91,12 +91,24 @@ namespace MeshExplorer.Generators
InputGeometry input = new InputGeometry(numPoints);
- double r, phi, radius = 100;
+ int i = 0, cNum = 2 * (int)Math.Floor(Math.Sqrt(numPoints));
- for (int i = 0; i < numPoints; i++)
+ double r, phi, radius = 100, step = 2 * Math.PI / cNum;
+
+ // Distrubute points equally on circle border
+ for (; i < cNum; i++)
+ {
+ // Add a little error
+ r = Util.Random.NextDouble();
+
+ input.AddPoint((radius + r) * Math.Cos(i * step),
+ (radius + r) * Math.Sin(i * step));
+ }
+
+ for (; i < numPoints; i++)
{
// Use sqrt(rand) to get normal distribution right.
- r = Math.Pow(Util.Random.NextDouble(), exp) * radius;
+ r = Math.Pow(Util.Random.NextDouble(), exp) * radius;
phi = Util.Random.NextDouble() * Math.PI * 2;
input.AddPoint(r * Math.Cos(phi), r * Math.Sin(phi));
diff --git a/Triangle.NET/TestApp/IO/EpsImage.cs b/Triangle.NET/TestApp/IO/EpsImage.cs
index a2e319a..86450af 100644
--- a/Triangle.NET/TestApp/IO/EpsImage.cs
+++ b/Triangle.NET/TestApp/IO/EpsImage.cs
@@ -8,14 +8,11 @@
namespace MeshExplorer.IO
{
using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using MeshExplorer.Rendering;
using System.IO;
+ using System.Text;
using TriangleNet;
- using TriangleNet.Geometry;
using TriangleNet.Data;
+ using TriangleNet.Geometry;
///
/// Writes a mesh to an EPS file.
diff --git a/Triangle.NET/TestApp/IO/FileProcessor.cs b/Triangle.NET/TestApp/IO/FileProcessor.cs
index 28e4ee5..3e0d3c4 100644
--- a/Triangle.NET/TestApp/IO/FileProcessor.cs
+++ b/Triangle.NET/TestApp/IO/FileProcessor.cs
@@ -21,6 +21,21 @@ namespace MeshExplorer.IO
{
static Dictionary container = new Dictionary();
+ public static bool CanHandleFile(string path)
+ {
+ if (File.Exists(path))
+ {
+ var provider = GetProviderInstance(path);
+
+ if (provider != null)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
///
/// Returns true, if the given file contains mesh information.
///
@@ -69,7 +84,7 @@ namespace MeshExplorer.IO
{
string ext = Path.GetExtension(path);
- IMeshFile provider;
+ IMeshFile provider = null;
if (container.ContainsKey(ext))
{
diff --git a/Triangle.NET/TestApp/IO/Formats/JsonFile.cs b/Triangle.NET/TestApp/IO/Formats/JsonFile.cs
index 3419453..d4c57e6 100644
--- a/Triangle.NET/TestApp/IO/Formats/JsonFile.cs
+++ b/Triangle.NET/TestApp/IO/Formats/JsonFile.cs
@@ -7,16 +7,14 @@
namespace MeshExplorer.IO.Formats
{
using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using TriangleNet.IO;
- using System.IO;
- using MeshExplorer.Rendering;
- using TriangleNet.Geometry;
- using TriangleNet;
using System.Collections;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Text;
+ using TriangleNet;
using TriangleNet.Data;
+ using TriangleNet.Geometry;
+ using TriangleNet.IO;
///
/// Read and write JSON files.
@@ -132,21 +130,21 @@ namespace MeshExplorer.IO.Formats
if (ns > 0)
{
writer.Write(",");
- WriteSegments(mesh, writer, ns);
+ WriteSegments(mesh.Segments, writer, ns);
}
// Write the holes
if (nh > 0)
{
writer.Write(",");
- WriteHoles(mesh, writer, nh);
+ WriteHoles(mesh.Holes, writer, nh);
}
// Write the elements
if (ne > 0)
{
writer.Write(",");
- WriteTriangles(mesh, writer, ne);
+ WriteTriangles(mesh.Triangles, writer, ne);
}
writer.Write("}");
@@ -413,7 +411,7 @@ namespace MeshExplorer.IO.Formats
if (mesh.CurrentNumbering == NodeNumbering.Linear)
{
- markers = WritePoints(writer, mesh.Vertices, nv, useMarkers);
+ markers = WritePoints(mesh.Vertices, writer, nv, useMarkers);
}
else
{
@@ -424,7 +422,7 @@ namespace MeshExplorer.IO.Formats
nodes[node.ID] = node;
}
- markers = WritePoints(writer, nodes, nv, useMarkers);
+ markers = WritePoints(nodes, writer, nv, useMarkers);
}
writer.Write("]");
@@ -437,13 +435,13 @@ namespace MeshExplorer.IO.Formats
writer.Write("}");
}
- private static StringBuilder WritePoints(StreamWriter writer, IEnumerable nodes, int nv, bool useMarkers)
+ private static StringBuilder WritePoints(IEnumerable data, StreamWriter writer, int nv, bool useMarkers)
{
StringBuilder markers = new StringBuilder();
int i = 0;
string seperator;
- foreach (var item in nodes)
+ foreach (var item in data)
{
seperator = (i == nv - 1) ? String.Empty : ", ";
@@ -464,12 +462,12 @@ namespace MeshExplorer.IO.Formats
return markers;
}
- private void WriteHoles(Mesh data, StreamWriter writer, int nh)
+ private void WriteHoles(IEnumerable data, StreamWriter writer, int nh)
{
int i = 0;
writer.Write("\"holes\":[");
- foreach (var item in data.Holes)
+ foreach (var item in data)
{
writer.Write("{0},{1}{2}",
item.X.ToString(Util.Nfi),
@@ -481,7 +479,7 @@ namespace MeshExplorer.IO.Formats
writer.Write("]");
}
- private void WriteSegments(Mesh data, StreamWriter writer, int ns)
+ private void WriteSegments(IEnumerable data, StreamWriter writer, int ns)
{
int i = 0;
@@ -491,7 +489,7 @@ namespace MeshExplorer.IO.Formats
string seperator;
writer.Write("\"segments\":{\"data\":[");
- foreach (var item in data.Segments)
+ foreach (var item in data)
{
seperator = (i == ns - 1) ? String.Empty : ", ";
@@ -518,7 +516,7 @@ namespace MeshExplorer.IO.Formats
writer.Write("}");
}
- private void WriteTriangles(Mesh data, StreamWriter writer, int ne)
+ private void WriteTriangles(IEnumerable data, StreamWriter writer, int ne)
{
int i = 0;
@@ -527,7 +525,7 @@ namespace MeshExplorer.IO.Formats
string seperator;
writer.Write("\"triangles\":{\"data\":[");
- foreach (var item in data.Triangles)
+ foreach (var item in data)
{
seperator = (i == ne - 1) ? String.Empty : ", ";
diff --git a/Triangle.NET/TestApp/IO/RasterImage.cs b/Triangle.NET/TestApp/IO/RasterImage.cs
index 141aa56..9da32e5 100644
--- a/Triangle.NET/TestApp/IO/RasterImage.cs
+++ b/Triangle.NET/TestApp/IO/RasterImage.cs
@@ -6,25 +6,23 @@
namespace MeshExplorer.IO
{
- using MeshExplorer.Rendering;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using TriangleNet;
- using TriangleNet.Data;
- using TriangleNet.IO;
- using TriangleNet.Tools;
+ using MeshRenderer.Core;
+ using MeshRenderer.Core.GDI;
///
/// Writes an image of the mesh to disk.
///
public class RasterImage
{
- RenderColors colors = RenderColors.Default();
+ ColorManager colors = ColorManager.Default();
- public RenderColors ColorScheme
+ public ColorManager ColorScheme
{
get { return colors; }
set { colors = value; }
@@ -40,7 +38,7 @@ namespace MeshExplorer.IO
{
// Get mesh data -- TODO: Use RenderControl's RenderData
RenderData data = new RenderData();
- data.SetData(mesh);
+ data.SetMesh(mesh);
// Check file name
if (String.IsNullOrWhiteSpace(filename))
diff --git a/Triangle.NET/TestApp/IO/SvgImage.cs b/Triangle.NET/TestApp/IO/SvgImage.cs
index fec887f..ec285f6 100644
--- a/Triangle.NET/TestApp/IO/SvgImage.cs
+++ b/Triangle.NET/TestApp/IO/SvgImage.cs
@@ -7,14 +7,10 @@
namespace MeshExplorer.IO
{
using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using MeshExplorer.Rendering;
using System.IO;
+ using System.Text;
using TriangleNet;
using TriangleNet.Data;
- using TriangleNet.Geometry;
///
/// Writes a mesh to an SVG file.
diff --git a/Triangle.NET/TestApp/Mesh Explorer.csproj b/Triangle.NET/TestApp/Mesh Explorer.csproj
index 76e463e..1645317 100644
--- a/Triangle.NET/TestApp/Mesh Explorer.csproj
+++ b/Triangle.NET/TestApp/Mesh Explorer.csproj
@@ -69,13 +69,9 @@
Component
-
- Component
-
Form
-
Form
@@ -115,13 +111,27 @@
-
-
-
-
-
+
+ UserControl
+
+
+ AboutView.cs
+
+
+
+ UserControl
+
+
+ MeshControlView.cs
+
+
+ UserControl
+
+
+ StatisticView.cs
+
FormExport.cs
@@ -131,8 +141,21 @@
FormMain.cs
+
+ AboutView.cs
+
+
+ MeshControlView.cs
+
+
+ StatisticView.cs
+
+
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}
+ MeshRenderer.Core
+
{F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}
Triangle
diff --git a/Triangle.NET/TestApp/Rendering/RenderColors.cs b/Triangle.NET/TestApp/Rendering/RenderColors.cs
deleted file mode 100644
index c9d092f..0000000
--- a/Triangle.NET/TestApp/Rendering/RenderColors.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
-//
-// -----------------------------------------------------------------------
-
-namespace MeshExplorer.Rendering
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Drawing;
-
- ///
- /// Mesh color scheme.
- ///
- public class RenderColors
- {
- ///
- /// Gets a color scheme with black background.
- ///
- public static RenderColors Default()
- {
- var colors = new RenderColors();
-
- colors.Background = Color.FromArgb(0, 0, 0);
- colors.Point = new SolidBrush(Color.Green);
- colors.SteinerPoint = new SolidBrush(Color.Peru);
- colors.Triangle = new SolidBrush(Color.Black);
- colors.Line = new Pen(Color.FromArgb(30, 30, 30));
- colors.Segment = new Pen(Color.DarkBlue);
- colors.VoronoiLine = new Pen(Color.FromArgb(40, 50, 60));
-
- return colors;
- }
- ///
- /// Gets a color scheme with white background.
- ///
- public static RenderColors LightScheme()
- {
- var colors = new RenderColors();
-
- colors.Background = Color.White;
- colors.Point = new SolidBrush(Color.FromArgb(60, 80, 120));
- colors.SteinerPoint = new SolidBrush(Color.DarkGreen);
- colors.Triangle = new SolidBrush(Color.FromArgb(230, 240, 250));
- colors.Line = new Pen(Color.FromArgb(150, 150, 150));
- colors.Segment = new Pen(Color.SteelBlue);
- colors.VoronoiLine = new Pen(Color.FromArgb(160, 170, 180));
-
- return colors;
- }
-
- public Color Background;
- public Brush Point;
- public Brush SteinerPoint;
- public Brush Triangle;
- public Pen Line;
- public Pen Segment;
- public Pen VoronoiLine;
- }
-}
diff --git a/Triangle.NET/TestApp/Rendering/RenderData.cs b/Triangle.NET/TestApp/Rendering/RenderData.cs
deleted file mode 100644
index d435402..0000000
--- a/Triangle.NET/TestApp/Rendering/RenderData.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
-//
-// -----------------------------------------------------------------------
-
-namespace MeshExplorer.Rendering
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using TriangleNet.IO;
- using System.Drawing;
- using TriangleNet;
- using TriangleNet.Data;
- using TriangleNet.Geometry;
-
- ///
- /// Stores the current mesh in GDI friendly data structure.
- ///
- public class RenderData
- {
- public PointF[] Points;
-
- public Edge[] Edges;
- public Edge[] Segments;
- public IEnumerable Triangles;
-
- public int NumberOfInputPoints;
- public RectangleF Bounds;
-
- ///
- /// Update input geometry data.
- ///
- public void SetData(InputGeometry data)
- {
- int n = data.Count;
- int i = 0;
-
- this.NumberOfInputPoints = n;
-
- this.Triangles = null;
- this.Edges = null;
-
- // Convert points to float
- this.Points = new PointF[n];
- foreach (var pt in data.Points)
- {
- this.Points[i++] = new PointF((float)pt.X, (float)pt.Y);
- }
-
- this.Bounds = new RectangleF(
- (float)data.Bounds.Xmin,
- (float)data.Bounds.Ymin,
- (float)data.Bounds.Width,
- (float)data.Bounds.Height);
-
- // Copy segments
- this.Segments = data.Segments.ToArray();
- }
-
- ///
- /// Update mesh data.
- ///
- public void SetData(Mesh mesh)
- {
- mesh.Renumber();
-
- this.NumberOfInputPoints = mesh.NumberOfInputPoints;
-
- this.Triangles = mesh.Triangles;
-
- this.Segments = null;
-
- int n = mesh.Vertices.Count;
-
- // Convert points to float
- this.Points = new PointF[n];
-
- SetPoints(mesh.Vertices);
-
- // Get segments
- if (mesh.IsPolygon)
- {
- var segs = mesh.Segments;
-
- List segList = new List(mesh.Segments.Count);
-
- foreach (var seg in segs)
- {
- segList.Add(new Edge(seg.P0, seg.P1));
- }
-
- this.Segments = segList.ToArray();
- }
-
- // Get edges (more efficient than rendering triangles)
- EdgeEnumerator e = new EdgeEnumerator(mesh);
-
- List edgeList = new List(mesh.NumberOfEdges);
-
- while (e.MoveNext())
- {
- edgeList.Add(e.Current);
- }
-
- this.Edges = edgeList.ToArray();
- }
-
- private void SetPoints(IEnumerable points)
- {
- // Bounds
- float minx = float.MaxValue;
- float maxx = float.MinValue;
- float miny = float.MaxValue;
- float maxy = float.MinValue;
-
- float x, y;
- int i = 0;
-
- foreach (var pt in points)
- {
- x = (float)pt.X;
- y = (float)pt.Y;
- // Update bounding box
- if (minx > x) minx = x;
- if (maxx < x) maxx = x;
- if (miny > y) miny = y;
- if (maxy < y) maxy = y;
-
- this.Points[i] = new PointF(x, y);
-
- i++;
- }
-
- this.Bounds = new RectangleF(minx, miny, maxx - minx, maxy - miny);
- }
- }
-}
diff --git a/Triangle.NET/TestApp/Rendering/VoronoiRenderer.cs b/Triangle.NET/TestApp/Rendering/VoronoiRenderer.cs
deleted file mode 100644
index c0a7727..0000000
--- a/Triangle.NET/TestApp/Rendering/VoronoiRenderer.cs
+++ /dev/null
@@ -1,256 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// Christian Woltering, Triangle.NET, http://triangle.codeplex.com/
-//
-// -----------------------------------------------------------------------
-
-namespace MeshExplorer.Rendering
-{
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using TriangleNet;
- using TriangleNet.Tools;
-
- ///
- /// Renders a (bounded) Voronoi diagram.
- ///
- public class VoronoiRenderer
- {
- Mesh mesh;
- Voronoi simpleVoro;
- BoundedVoronoi boundedVoro;
- RenderColors renderColors;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public VoronoiRenderer(Mesh mesh)
- {
- this.mesh = mesh;
-
- //if (mesh.NumberOfSegments > 0)
- if (mesh.IsPolygon)
- {
- boundedVoro = new BoundedVoronoi(mesh);
- }
- else
- {
- simpleVoro = new Voronoi(mesh);
- }
- }
-
- ///
- /// Regenerates the voronoi diagram.
- ///
- public void Update()
- {
- if (simpleVoro != null)
- {
- simpleVoro.Generate();
- }
-
- if (boundedVoro != null)
- {
- boundedVoro.Generate();
- }
- }
-
- ///
- /// Resets the voronoi display.
- ///
- public void Reset()
- {
- simpleVoro = null;
- boundedVoro = null;
- }
-
- ///
- /// Renders the voronoi diagram.
- ///
- public void Render(Graphics g, Zoom zoom, RenderColors renderColors)
- {
- this.renderColors = renderColors;
-
- if (simpleVoro != null)
- {
- RenderSimple(g, zoom);
- return;
- }
-
- if (boundedVoro != null)
- {
- RenderBounded(g, zoom);
- return;
- }
- }
-
- private void RenderSimple(Graphics g, Zoom zoom)
- {
- PointF p0, p1;
-
- TriangleNet.Geometry.Point[] points = simpleVoro.Points;
-
- // Draw edges
- int n = simpleVoro.Edges == null ? 0 : simpleVoro.Edges.Length;
-
- for (int i = 0; i < n; i++)
- {
- var seg = simpleVoro.Edges[i];
-
- if (seg.P1 == -1)
- {
- // Infinite voronoi edge
- p0 = new PointF((float)points[seg.P0].X, (float)points[seg.P0].Y);
-
- if (zoom.ViewportContains(p0) &&
- BoxRayIntersection(points[seg.P0], simpleVoro.Directions[i], out p1))
- {
- RenderEdge(g, zoom, p0, p1);
- }
- }
- else
- {
- p0 = new PointF((float)points[seg.P0].X, (float)points[seg.P0].Y);
- p1 = new PointF((float)points[seg.P1].X, (float)points[seg.P1].Y);
-
- RenderEdge(g, zoom, p0, p1);
- }
- }
-
- // Scale the points radius to 2 pixel.
- //float radius = 1.5f / scale, x, y;
-
- // Draw points
- //n = voro.Points.Length;
-
- //for (int i = 0; i < n; i++)
- //{
- // x = (float)voro.Points[i].X;
- // y = (float)voro.Points[i].Y;
-
- // g.FillEllipse(Brushes.Blue, x - radius, y - radius, 2 * radius, 2 * radius);
- //}
- }
-
- private void RenderBounded(Graphics g, Zoom zoom)
- {
- PointF p0, p1;
- int n;
-
- foreach (var cell in boundedVoro.Cells)
- {
- n = cell.Length;
-
- for (int i = 1; i < n; i++)
- {
- p0 = new PointF((float)cell[i - 1].X, (float)cell[i - 1].Y);
- p1 = new PointF((float)cell[i].X, (float)cell[i].Y);
-
- RenderEdge(g, zoom, p0, p1);
- }
- }
- }
-
- private void RenderEdge(Graphics g, Zoom zoom, PointF p0, PointF p1)
- {
- if (zoom.ViewportContains(p0) ||
- zoom.ViewportContains(p1))
- {
- p0 = zoom.WorldToScreen(p0);
- p1 = zoom.WorldToScreen(p1);
-
- g.DrawLine(renderColors.VoronoiLine, p0, p1);
- }
- }
-
- private bool BoxRayIntersection(TriangleNet.Geometry.Point pt,
- TriangleNet.Geometry.Point direction, out PointF intersect)
- {
- double x = pt.X;
- double y = pt.Y;
- double dx = direction.X;
- double dy = direction.Y;
-
- double t1, x1, y1, t2, x2, y2;
-
- // Bounding box (50% enlarged)
- var box = mesh.Bounds;
-
- double dw = box.Width * 0.5f;
- double dh = box.Height * 0.5f;
-
- double minX = box.Xmin - dw;
- double maxX = box.Xmax + dw;
- double minY = box.Ymin - dh;
- double maxY = box.Ymax + dh;
-
- intersect = new PointF();
-
- // Check if point is inside the bounds
- if (x < minX || x > maxX || y < minY || y > maxY)
- {
- return false;
- }
-
- // Calculate the cut through the vertical boundaries
- if (dx < 0)
- {
- // Line going to the left: intersect with x = minX
- t1 = (minX - x) / dx;
- x1 = minX;
- y1 = y + t1 * dy;
- }
- else if (dx > 0)
- {
- // Line going to the right: intersect with x = maxX
- t1 = (maxX - x) / dx;
- x1 = maxX;
- y1 = y + t1 * dy;
- }
- else
- {
- // Line going straight up or down: no intersection possible
- t1 = double.MaxValue;
- x1 = y1 = 0;
- }
-
- // Calculate the cut through upper and lower boundaries
- if (dy < 0)
- {
- // Line going downwards: intersect with y = minY
- t2 = (minY - y) / dy;
- x2 = x + t2 * dx;
- y2 = minY;
- }
- else if (dx > 0)
- {
- // Line going upwards: intersect with y = maxY
- t2 = (maxY - y) / dy;
- x2 = x + t2 * dx;
- y2 = maxY;
- }
- else
- {
- // Horizontal line: no intersection possible
- t2 = double.MaxValue;
- x2 = y2 = 0;
- }
-
- if (t1 < t2)
- {
- intersect.X = (float)x1;
- intersect.Y = (float)y1;
- }
- else
- {
- intersect.X = (float)x2;
- intersect.Y = (float)y2;
- }
-
- return true;
- }
- }
-}
diff --git a/Triangle.NET/TestApp/Views/AboutView.Designer.cs b/Triangle.NET/TestApp/Views/AboutView.Designer.cs
new file mode 100644
index 0000000..05516dc
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/AboutView.Designer.cs
@@ -0,0 +1,145 @@
+namespace MeshExplorer.Views
+{
+ partial class AboutView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lbCodeplex = new System.Windows.Forms.Label();
+ this.label15 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label19 = new System.Windows.Forms.Label();
+ this.label18 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.lbShortcuts = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // lbCodeplex
+ //
+ this.lbCodeplex.AutoSize = true;
+ this.lbCodeplex.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lbCodeplex.ForeColor = System.Drawing.Color.White;
+ this.lbCodeplex.Location = new System.Drawing.Point(72, 82);
+ this.lbCodeplex.Name = "lbCodeplex";
+ this.lbCodeplex.Size = new System.Drawing.Size(153, 13);
+ this.lbCodeplex.TabIndex = 9;
+ this.lbCodeplex.Text = "http://triangle.codeplex.com";
+ this.lbCodeplex.Click += new System.EventHandler(this.lbCodeplex_Clicked);
+ //
+ // label15
+ //
+ this.label15.AutoSize = true;
+ this.label15.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label15.ForeColor = System.Drawing.Color.White;
+ this.label15.Location = new System.Drawing.Point(10, 17);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(73, 13);
+ this.label15.TabIndex = 7;
+ this.label15.Text = "Triangle.NET";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label1.ForeColor = System.Drawing.Color.White;
+ this.label1.Location = new System.Drawing.Point(10, 132);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(108, 13);
+ this.label1.TabIndex = 8;
+ this.label1.Text = "Keyboard shortcuts";
+ //
+ // label19
+ //
+ this.label19.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label19.ForeColor = System.Drawing.Color.White;
+ this.label19.Location = new System.Drawing.Point(72, 42);
+ this.label19.Name = "label19";
+ this.label19.Size = new System.Drawing.Size(134, 40);
+ this.label19.TabIndex = 6;
+ this.label19.Text = "Beta 2 (2012-10-14)\r\nChristian Woltering\r\nMIT";
+ //
+ // label18
+ //
+ this.label18.ForeColor = System.Drawing.Color.White;
+ this.label18.Location = new System.Drawing.Point(15, 42);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(51, 40);
+ this.label18.TabIndex = 4;
+ this.label18.Text = "Version:\r\nAuthor:\r\nLicense:";
+ this.label18.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ //
+ // label7
+ //
+ this.label7.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label7.ForeColor = System.Drawing.Color.White;
+ this.label7.Location = new System.Drawing.Point(72, 155);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(134, 108);
+ this.label7.TabIndex = 5;
+ this.label7.Text = "File Open\r\nFile Save\r\nReload Input\r\n\r\nTriangulate / Refine\r\nSmooth\r\n\r\nShow Log";
+ //
+ // lbShortcuts
+ //
+ this.lbShortcuts.ForeColor = System.Drawing.Color.White;
+ this.lbShortcuts.Location = new System.Drawing.Point(24, 155);
+ this.lbShortcuts.Name = "lbShortcuts";
+ this.lbShortcuts.Size = new System.Drawing.Size(36, 108);
+ this.lbShortcuts.TabIndex = 3;
+ this.lbShortcuts.Text = "F3\r\nF4\r\nF5\r\n\r\nF8\r\nF9\r\n\r\nF12";
+ this.lbShortcuts.TextAlign = System.Drawing.ContentAlignment.TopRight;
+ //
+ // AboutView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.DimGray;
+ this.Controls.Add(this.lbCodeplex);
+ this.Controls.Add(this.label15);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.label19);
+ this.Controls.Add(this.label18);
+ this.Controls.Add(this.label7);
+ this.Controls.Add(this.lbShortcuts);
+ this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.ForeColor = System.Drawing.Color.DarkGray;
+ this.Name = "AboutView";
+ this.Size = new System.Drawing.Size(272, 509);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbCodeplex;
+ private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label19;
+ private System.Windows.Forms.Label label18;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label lbShortcuts;
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/AboutView.cs b/Triangle.NET/TestApp/Views/AboutView.cs
new file mode 100644
index 0000000..9c712ae
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/AboutView.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using TriangleNet;
+using System.Diagnostics;
+using TriangleNet.Geometry;
+
+namespace MeshExplorer.Views
+{
+ public partial class AboutView : UserControl, IView
+ {
+ public AboutView()
+ {
+ InitializeComponent();
+ }
+
+ private void lbCodeplex_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ ProcessStartInfo info = new ProcessStartInfo("http://triangle.codeplex.com/");
+ Process.Start(info);
+ }
+ catch (Exception)
+ { }
+ }
+
+ #region IView
+
+ public void HandleNewInput(InputGeometry geometry)
+ {
+ }
+
+ public void HandleMeshImport(InputGeometry geometry, Mesh mesh)
+ {
+ }
+
+ public void HandleMeshUpdate(Mesh mesh)
+ {
+ }
+
+ public void HandleMeshChange(Mesh mesh)
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/AboutView.resx b/Triangle.NET/TestApp/Views/AboutView.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/AboutView.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Triangle.NET/TestApp/Views/IView.cs b/Triangle.NET/TestApp/Views/IView.cs
new file mode 100644
index 0000000..5b01b7e
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/IView.cs
@@ -0,0 +1,26 @@
+// -----------------------------------------------------------------------
+//
+// TODO: Update copyright text.
+//
+// -----------------------------------------------------------------------
+
+namespace MeshExplorer.Views
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using TriangleNet;
+ using TriangleNet.Geometry;
+
+ ///
+ /// TODO: Update summary.
+ ///
+ public interface IView
+ {
+ void HandleNewInput(InputGeometry geometry);
+ void HandleMeshImport(InputGeometry geometry, Mesh mesh);
+ void HandleMeshUpdate(Mesh mesh);
+ void HandleMeshChange(Mesh mesh);
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/MeshControlView.Designer.cs b/Triangle.NET/TestApp/Views/MeshControlView.Designer.cs
new file mode 100644
index 0000000..7117dc4
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/MeshControlView.Designer.cs
@@ -0,0 +1,219 @@
+namespace MeshExplorer.Views
+{
+ partial class MeshControlView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lbMaxArea = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.lbMinAngle = new System.Windows.Forms.Label();
+ this.label23 = new System.Windows.Forms.Label();
+ this.label9 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.slMaxArea = new MeshExplorer.Controls.DarkSlider();
+ this.slMinAngle = new MeshExplorer.Controls.DarkSlider();
+ this.cbConformDel = new MeshExplorer.Controls.DarkCheckBox();
+ this.cbConvex = new MeshExplorer.Controls.DarkCheckBox();
+ this.cbQuality = new MeshExplorer.Controls.DarkCheckBox();
+ this.SuspendLayout();
+ //
+ // lbMaxArea
+ //
+ this.lbMaxArea.AutoSize = true;
+ this.lbMaxArea.ForeColor = System.Drawing.Color.White;
+ this.lbMaxArea.Location = new System.Drawing.Point(227, 65);
+ this.lbMaxArea.Name = "lbMaxArea";
+ this.lbMaxArea.Size = new System.Drawing.Size(13, 13);
+ this.lbMaxArea.TabIndex = 20;
+ this.lbMaxArea.Text = "0";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.ForeColor = System.Drawing.Color.White;
+ this.label6.Location = new System.Drawing.Point(8, 64);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(81, 13);
+ this.label6.TabIndex = 23;
+ this.label6.Text = "Maximum area";
+ //
+ // lbMinAngle
+ //
+ this.lbMinAngle.AutoSize = true;
+ this.lbMinAngle.ForeColor = System.Drawing.Color.White;
+ this.lbMinAngle.Location = new System.Drawing.Point(227, 43);
+ this.lbMinAngle.Name = "lbMinAngle";
+ this.lbMinAngle.Size = new System.Drawing.Size(19, 13);
+ this.lbMinAngle.TabIndex = 22;
+ this.lbMinAngle.Text = "20";
+ //
+ // label23
+ //
+ this.label23.BackColor = System.Drawing.Color.DimGray;
+ this.label23.ForeColor = System.Drawing.Color.DarkGray;
+ this.label23.Location = new System.Drawing.Point(8, 151);
+ this.label23.Name = "label23";
+ this.label23.Size = new System.Drawing.Size(251, 33);
+ this.label23.TabIndex = 24;
+ this.label23.Text = "Ensure that all triangles in the mesh are truly Delaunay, and not just constraine" +
+ "d Delaunay.";
+ //
+ // label9
+ //
+ this.label9.BackColor = System.Drawing.Color.DimGray;
+ this.label9.ForeColor = System.Drawing.Color.DarkGray;
+ this.label9.Location = new System.Drawing.Point(8, 215);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(258, 33);
+ this.label9.TabIndex = 26;
+ this.label9.Text = "Use the convex mesh option, if the convex hull should be included in the output.";
+ //
+ // label8
+ //
+ this.label8.BackColor = System.Drawing.Color.DimGray;
+ this.label8.ForeColor = System.Drawing.Color.DarkGray;
+ this.label8.Location = new System.Drawing.Point(8, 88);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(258, 33);
+ this.label8.TabIndex = 25;
+ this.label8.Text = "Hint: maximum area values of 0 or 1 will be irgnored (no area constraints are set" +
+ ").";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.ForeColor = System.Drawing.Color.White;
+ this.label5.Location = new System.Drawing.Point(8, 42);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(87, 13);
+ this.label5.TabIndex = 21;
+ this.label5.Text = "Minimum angle";
+ //
+ // slMaxArea
+ //
+ this.slMaxArea.BackColor = System.Drawing.Color.Transparent;
+ this.slMaxArea.CriticalPercent = ((uint)(0u));
+ this.slMaxArea.Location = new System.Drawing.Point(102, 61);
+ this.slMaxArea.Maximum = 100;
+ this.slMaxArea.Minimum = 0;
+ this.slMaxArea.Name = "slMaxArea";
+ this.slMaxArea.Size = new System.Drawing.Size(119, 18);
+ this.slMaxArea.TabIndex = 19;
+ this.slMaxArea.Text = "darkSlider1";
+ this.slMaxArea.Value = 0;
+ this.slMaxArea.ValueChanging += new System.EventHandler(this.slMaxArea_ValueChanging);
+ //
+ // slMinAngle
+ //
+ this.slMinAngle.BackColor = System.Drawing.Color.Transparent;
+ this.slMinAngle.CriticalPercent = ((uint)(89u));
+ this.slMinAngle.Location = new System.Drawing.Point(102, 39);
+ this.slMinAngle.Maximum = 100;
+ this.slMinAngle.Minimum = 0;
+ this.slMinAngle.Name = "slMinAngle";
+ this.slMinAngle.Size = new System.Drawing.Size(119, 18);
+ this.slMinAngle.TabIndex = 18;
+ this.slMinAngle.Text = "darkSlider1";
+ this.slMinAngle.Value = 50;
+ this.slMinAngle.ValueChanging += new System.EventHandler(this.slMinAngle_ValueChanging);
+ //
+ // cbConformDel
+ //
+ this.cbConformDel.BackColor = System.Drawing.Color.DimGray;
+ this.cbConformDel.Checked = false;
+ this.cbConformDel.Location = new System.Drawing.Point(11, 131);
+ this.cbConformDel.Name = "cbConformDel";
+ this.cbConformDel.Size = new System.Drawing.Size(142, 17);
+ this.cbConformDel.TabIndex = 16;
+ this.cbConformDel.Text = "Conforming Delaunay";
+ this.cbConformDel.UseVisualStyleBackColor = false;
+ //
+ // cbConvex
+ //
+ this.cbConvex.BackColor = System.Drawing.Color.DimGray;
+ this.cbConvex.Checked = false;
+ this.cbConvex.Location = new System.Drawing.Point(11, 195);
+ this.cbConvex.Name = "cbConvex";
+ this.cbConvex.Size = new System.Drawing.Size(115, 17);
+ this.cbConvex.TabIndex = 15;
+ this.cbConvex.Text = "Convex mesh";
+ this.cbConvex.UseVisualStyleBackColor = false;
+ //
+ // cbQuality
+ //
+ this.cbQuality.BackColor = System.Drawing.Color.DimGray;
+ this.cbQuality.Checked = false;
+ this.cbQuality.Location = new System.Drawing.Point(11, 16);
+ this.cbQuality.Name = "cbQuality";
+ this.cbQuality.Size = new System.Drawing.Size(115, 17);
+ this.cbQuality.TabIndex = 17;
+ this.cbQuality.Text = "Quality mesh";
+ this.cbQuality.UseVisualStyleBackColor = false;
+ //
+ // MeshControlView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.DimGray;
+ this.Controls.Add(this.lbMaxArea);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.lbMinAngle);
+ this.Controls.Add(this.label23);
+ this.Controls.Add(this.label9);
+ this.Controls.Add(this.label8);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.slMaxArea);
+ this.Controls.Add(this.slMinAngle);
+ this.Controls.Add(this.cbConformDel);
+ this.Controls.Add(this.cbConvex);
+ this.Controls.Add(this.cbQuality);
+ this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.ForeColor = System.Drawing.Color.DarkGray;
+ this.Name = "MeshControlView";
+ this.Size = new System.Drawing.Size(272, 509);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbMaxArea;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label lbMinAngle;
+ private System.Windows.Forms.Label label23;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label5;
+ private Controls.DarkSlider slMaxArea;
+ private Controls.DarkSlider slMinAngle;
+ private Controls.DarkCheckBox cbConformDel;
+ private Controls.DarkCheckBox cbConvex;
+ private Controls.DarkCheckBox cbQuality;
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/MeshControlView.cs b/Triangle.NET/TestApp/Views/MeshControlView.cs
new file mode 100644
index 0000000..0b30bc4
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/MeshControlView.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using TriangleNet;
+using TriangleNet.Geometry;
+
+namespace MeshExplorer.Views
+{
+ public partial class MeshControlView : UserControl, IView
+ {
+ public MeshControlView()
+ {
+ InitializeComponent();
+ }
+
+ public bool ParamQualityChecked
+ {
+ get { return cbQuality.Checked; }
+ }
+
+ public bool ParamConvexChecked
+ {
+ get { return cbConvex.Checked; }
+ }
+
+ public bool ParamConformDelChecked
+ {
+ get { return cbConformDel.Checked; }
+ }
+
+ public int ParamMinAngleValue
+ {
+ get { return (slMinAngle.Value * 40) / 100; }
+ }
+
+ public double ParamMaxAreaValue
+ {
+ get { return slMaxArea.Value * 0.01; }
+ }
+
+ private void slMinAngle_ValueChanging(object sender, EventArgs e)
+ {
+ // Between 0 and 40 (step 1)
+ int angle = (slMinAngle.Value * 40) / 100;
+ lbMinAngle.Text = angle.ToString();
+ }
+
+ private void slMaxArea_ValueChanging(object sender, EventArgs e)
+ {
+ // Between 0 and 1 (step 0.01)
+ double area = slMaxArea.Value * 0.01;
+ lbMaxArea.Text = area.ToString(Util.Nfi);
+ }
+
+ #region IView
+
+ public void HandleNewInput(InputGeometry geometry)
+ {
+ }
+
+ public void HandleMeshImport(InputGeometry geometry, Mesh mesh)
+ {
+ }
+
+ public void HandleMeshUpdate(Mesh mesh)
+ {
+ }
+
+ public void HandleMeshChange(Mesh mesh)
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/MeshControlView.resx b/Triangle.NET/TestApp/Views/MeshControlView.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/MeshControlView.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Triangle.NET/TestApp/Views/StatisticView.Designer.cs b/Triangle.NET/TestApp/Views/StatisticView.Designer.cs
new file mode 100644
index 0000000..c0a418e
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/StatisticView.Designer.cs
@@ -0,0 +1,483 @@
+namespace MeshExplorer.Views
+{
+ partial class StatisticView
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label20 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.lbNumSeg = new System.Windows.Forms.Label();
+ this.lbNumSeg2 = new System.Windows.Forms.Label();
+ this.lbNumTri = new System.Windows.Forms.Label();
+ this.lbNumTri2 = new System.Windows.Forms.Label();
+ this.lbNumVert = new System.Windows.Forms.Label();
+ this.lbNumVert2 = new System.Windows.Forms.Label();
+ this.label32 = new System.Windows.Forms.Label();
+ this.label13 = new System.Windows.Forms.Label();
+ this.label31 = new System.Windows.Forms.Label();
+ this.label12 = new System.Windows.Forms.Label();
+ this.label16 = new System.Windows.Forms.Label();
+ this.label29 = new System.Windows.Forms.Label();
+ this.label14 = new System.Windows.Forms.Label();
+ this.lbAngleMax = new System.Windows.Forms.Label();
+ this.lbQualAspectAve = new System.Windows.Forms.Label();
+ this.lbEdgeMax = new System.Windows.Forms.Label();
+ this.lbQualAlphaAve = new System.Windows.Forms.Label();
+ this.lbAreaMax = new System.Windows.Forms.Label();
+ this.lbAngleMin = new System.Windows.Forms.Label();
+ this.lbQualAspectMin = new System.Windows.Forms.Label();
+ this.lbEdgeMin = new System.Windows.Forms.Label();
+ this.lbQualAlphaMin = new System.Windows.Forms.Label();
+ this.lbAreaMin = new System.Windows.Forms.Label();
+ this.label22 = new System.Windows.Forms.Label();
+ this.label10 = new System.Windows.Forms.Label();
+ this.label17 = new System.Windows.Forms.Label();
+ this.label21 = new System.Windows.Forms.Label();
+ this.label11 = new System.Windows.Forms.Label();
+ this.angleHistogram1 = new MeshExplorer.Controls.AngleHistogram();
+ this.SuspendLayout();
+ //
+ // label20
+ //
+ this.label20.AutoSize = true;
+ this.label20.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label20.ForeColor = System.Drawing.Color.White;
+ this.label20.Location = new System.Drawing.Point(8, 17);
+ this.label20.Name = "label20";
+ this.label20.Size = new System.Drawing.Size(39, 13);
+ this.label20.TabIndex = 59;
+ this.label20.Text = "Mesh:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.ForeColor = System.Drawing.Color.DarkGray;
+ this.label4.Location = new System.Drawing.Point(8, 57);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(60, 13);
+ this.label4.TabIndex = 56;
+ this.label4.Text = "Segments:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.ForeColor = System.Drawing.Color.DarkGray;
+ this.label3.Location = new System.Drawing.Point(8, 76);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(56, 13);
+ this.label3.TabIndex = 57;
+ this.label3.Text = "Triangles:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.ForeColor = System.Drawing.Color.DarkGray;
+ this.label2.Location = new System.Drawing.Point(8, 38);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(50, 13);
+ this.label2.TabIndex = 58;
+ this.label2.Text = "Vertices:";
+ //
+ // lbNumSeg
+ //
+ this.lbNumSeg.ForeColor = System.Drawing.Color.White;
+ this.lbNumSeg.Location = new System.Drawing.Point(98, 57);
+ this.lbNumSeg.Name = "lbNumSeg";
+ this.lbNumSeg.Size = new System.Drawing.Size(70, 13);
+ this.lbNumSeg.TabIndex = 53;
+ this.lbNumSeg.Text = "-";
+ this.lbNumSeg.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbNumSeg2
+ //
+ this.lbNumSeg2.ForeColor = System.Drawing.Color.DarkGray;
+ this.lbNumSeg2.Location = new System.Drawing.Point(188, 57);
+ this.lbNumSeg2.Name = "lbNumSeg2";
+ this.lbNumSeg2.Size = new System.Drawing.Size(70, 13);
+ this.lbNumSeg2.TabIndex = 52;
+ this.lbNumSeg2.Text = "-";
+ this.lbNumSeg2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbNumTri
+ //
+ this.lbNumTri.ForeColor = System.Drawing.Color.White;
+ this.lbNumTri.Location = new System.Drawing.Point(98, 76);
+ this.lbNumTri.Name = "lbNumTri";
+ this.lbNumTri.Size = new System.Drawing.Size(70, 13);
+ this.lbNumTri.TabIndex = 50;
+ this.lbNumTri.Text = "-";
+ this.lbNumTri.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbNumTri2
+ //
+ this.lbNumTri2.ForeColor = System.Drawing.Color.DarkGray;
+ this.lbNumTri2.Location = new System.Drawing.Point(188, 76);
+ this.lbNumTri2.Name = "lbNumTri2";
+ this.lbNumTri2.Size = new System.Drawing.Size(70, 13);
+ this.lbNumTri2.TabIndex = 51;
+ this.lbNumTri2.Text = "-";
+ this.lbNumTri2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbNumVert
+ //
+ this.lbNumVert.ForeColor = System.Drawing.Color.White;
+ this.lbNumVert.Location = new System.Drawing.Point(98, 38);
+ this.lbNumVert.Name = "lbNumVert";
+ this.lbNumVert.Size = new System.Drawing.Size(70, 13);
+ this.lbNumVert.TabIndex = 54;
+ this.lbNumVert.Text = "-";
+ this.lbNumVert.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbNumVert2
+ //
+ this.lbNumVert2.ForeColor = System.Drawing.Color.DarkGray;
+ this.lbNumVert2.Location = new System.Drawing.Point(188, 38);
+ this.lbNumVert2.Name = "lbNumVert2";
+ this.lbNumVert2.Size = new System.Drawing.Size(70, 13);
+ this.lbNumVert2.TabIndex = 55;
+ this.lbNumVert2.Text = "-";
+ this.lbNumVert2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label32
+ //
+ this.label32.AutoSize = true;
+ this.label32.ForeColor = System.Drawing.Color.DarkGray;
+ this.label32.Location = new System.Drawing.Point(210, 213);
+ this.label32.Name = "label32";
+ this.label32.Size = new System.Drawing.Size(48, 13);
+ this.label32.TabIndex = 41;
+ this.label32.Text = "Average";
+ //
+ // label13
+ //
+ this.label13.AutoSize = true;
+ this.label13.ForeColor = System.Drawing.Color.DarkGray;
+ this.label13.Location = new System.Drawing.Point(202, 114);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(56, 13);
+ this.label13.TabIndex = 42;
+ this.label13.Text = "Maximum";
+ //
+ // label31
+ //
+ this.label31.AutoSize = true;
+ this.label31.ForeColor = System.Drawing.Color.DarkGray;
+ this.label31.Location = new System.Drawing.Point(112, 213);
+ this.label31.Name = "label31";
+ this.label31.Size = new System.Drawing.Size(55, 13);
+ this.label31.TabIndex = 44;
+ this.label31.Text = "Minimum";
+ //
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.ForeColor = System.Drawing.Color.DarkGray;
+ this.label12.Location = new System.Drawing.Point(113, 114);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(55, 13);
+ this.label12.TabIndex = 43;
+ this.label12.Text = "Minimum";
+ //
+ // label16
+ //
+ this.label16.AutoSize = true;
+ this.label16.ForeColor = System.Drawing.Color.DarkGray;
+ this.label16.Location = new System.Drawing.Point(8, 173);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(40, 13);
+ this.label16.TabIndex = 40;
+ this.label16.Text = "Angle:";
+ //
+ // label29
+ //
+ this.label29.AutoSize = true;
+ this.label29.ForeColor = System.Drawing.Color.DarkGray;
+ this.label29.Location = new System.Drawing.Point(8, 253);
+ this.label29.Name = "label29";
+ this.label29.Size = new System.Drawing.Size(71, 13);
+ this.label29.TabIndex = 47;
+ this.label29.Text = "Aspect ratio:";
+ //
+ // label14
+ //
+ this.label14.AutoSize = true;
+ this.label14.ForeColor = System.Drawing.Color.DarkGray;
+ this.label14.Location = new System.Drawing.Point(8, 154);
+ this.label14.Name = "label14";
+ this.label14.Size = new System.Drawing.Size(73, 13);
+ this.label14.TabIndex = 48;
+ this.label14.Text = "Edge length:";
+ //
+ // lbAngleMax
+ //
+ this.lbAngleMax.ForeColor = System.Drawing.Color.White;
+ this.lbAngleMax.Location = new System.Drawing.Point(182, 173);
+ this.lbAngleMax.Name = "lbAngleMax";
+ this.lbAngleMax.Size = new System.Drawing.Size(76, 13);
+ this.lbAngleMax.TabIndex = 49;
+ this.lbAngleMax.Text = "-";
+ this.lbAngleMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbQualAspectAve
+ //
+ this.lbQualAspectAve.ForeColor = System.Drawing.Color.White;
+ this.lbQualAspectAve.Location = new System.Drawing.Point(182, 253);
+ this.lbQualAspectAve.Name = "lbQualAspectAve";
+ this.lbQualAspectAve.Size = new System.Drawing.Size(76, 13);
+ this.lbQualAspectAve.TabIndex = 46;
+ this.lbQualAspectAve.Text = "-";
+ this.lbQualAspectAve.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbEdgeMax
+ //
+ this.lbEdgeMax.ForeColor = System.Drawing.Color.White;
+ this.lbEdgeMax.Location = new System.Drawing.Point(182, 154);
+ this.lbEdgeMax.Name = "lbEdgeMax";
+ this.lbEdgeMax.Size = new System.Drawing.Size(76, 13);
+ this.lbEdgeMax.TabIndex = 45;
+ this.lbEdgeMax.Text = "-";
+ this.lbEdgeMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbQualAlphaAve
+ //
+ this.lbQualAlphaAve.ForeColor = System.Drawing.Color.White;
+ this.lbQualAlphaAve.Location = new System.Drawing.Point(182, 234);
+ this.lbQualAlphaAve.Name = "lbQualAlphaAve";
+ this.lbQualAlphaAve.Size = new System.Drawing.Size(76, 13);
+ this.lbQualAlphaAve.TabIndex = 30;
+ this.lbQualAlphaAve.Text = "-";
+ this.lbQualAlphaAve.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbAreaMax
+ //
+ this.lbAreaMax.ForeColor = System.Drawing.Color.White;
+ this.lbAreaMax.Location = new System.Drawing.Point(182, 135);
+ this.lbAreaMax.Name = "lbAreaMax";
+ this.lbAreaMax.Size = new System.Drawing.Size(76, 13);
+ this.lbAreaMax.TabIndex = 31;
+ this.lbAreaMax.Text = "-";
+ this.lbAreaMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbAngleMin
+ //
+ this.lbAngleMin.ForeColor = System.Drawing.Color.White;
+ this.lbAngleMin.Location = new System.Drawing.Point(100, 173);
+ this.lbAngleMin.Name = "lbAngleMin";
+ this.lbAngleMin.Size = new System.Drawing.Size(68, 13);
+ this.lbAngleMin.TabIndex = 32;
+ this.lbAngleMin.Text = "-";
+ this.lbAngleMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbQualAspectMin
+ //
+ this.lbQualAspectMin.ForeColor = System.Drawing.Color.White;
+ this.lbQualAspectMin.Location = new System.Drawing.Point(100, 253);
+ this.lbQualAspectMin.Name = "lbQualAspectMin";
+ this.lbQualAspectMin.Size = new System.Drawing.Size(68, 13);
+ this.lbQualAspectMin.TabIndex = 29;
+ this.lbQualAspectMin.Text = "-";
+ this.lbQualAspectMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbEdgeMin
+ //
+ this.lbEdgeMin.ForeColor = System.Drawing.Color.White;
+ this.lbEdgeMin.Location = new System.Drawing.Point(100, 154);
+ this.lbEdgeMin.Name = "lbEdgeMin";
+ this.lbEdgeMin.Size = new System.Drawing.Size(68, 13);
+ this.lbEdgeMin.TabIndex = 28;
+ this.lbEdgeMin.Text = "-";
+ this.lbEdgeMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbQualAlphaMin
+ //
+ this.lbQualAlphaMin.ForeColor = System.Drawing.Color.White;
+ this.lbQualAlphaMin.Location = new System.Drawing.Point(100, 234);
+ this.lbQualAlphaMin.Name = "lbQualAlphaMin";
+ this.lbQualAlphaMin.Size = new System.Drawing.Size(68, 13);
+ this.lbQualAlphaMin.TabIndex = 37;
+ this.lbQualAlphaMin.Text = "-";
+ this.lbQualAlphaMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // lbAreaMin
+ //
+ this.lbAreaMin.ForeColor = System.Drawing.Color.White;
+ this.lbAreaMin.Location = new System.Drawing.Point(100, 135);
+ this.lbAreaMin.Name = "lbAreaMin";
+ this.lbAreaMin.Size = new System.Drawing.Size(68, 13);
+ this.lbAreaMin.TabIndex = 36;
+ this.lbAreaMin.Text = "-";
+ this.lbAreaMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // label22
+ //
+ this.label22.AutoSize = true;
+ this.label22.ForeColor = System.Drawing.Color.DarkGray;
+ this.label22.Location = new System.Drawing.Point(8, 234);
+ this.label22.Name = "label22";
+ this.label22.Size = new System.Drawing.Size(65, 13);
+ this.label22.TabIndex = 39;
+ this.label22.Text = "Min. angle:";
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.ForeColor = System.Drawing.Color.DarkGray;
+ this.label10.Location = new System.Drawing.Point(8, 135);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(76, 13);
+ this.label10.TabIndex = 38;
+ this.label10.Text = "Triangle area:";
+ //
+ // label17
+ //
+ this.label17.AutoSize = true;
+ this.label17.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label17.ForeColor = System.Drawing.Color.White;
+ this.label17.Location = new System.Drawing.Point(8, 290);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(97, 13);
+ this.label17.TabIndex = 33;
+ this.label17.Text = "Angle histogram:";
+ //
+ // label21
+ //
+ this.label21.AutoSize = true;
+ this.label21.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label21.ForeColor = System.Drawing.Color.White;
+ this.label21.Location = new System.Drawing.Point(8, 213);
+ this.label21.Name = "label21";
+ this.label21.Size = new System.Drawing.Size(47, 13);
+ this.label21.TabIndex = 35;
+ this.label21.Text = "Quality:";
+ //
+ // label11
+ //
+ this.label11.AutoSize = true;
+ this.label11.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.label11.ForeColor = System.Drawing.Color.White;
+ this.label11.Location = new System.Drawing.Point(8, 114);
+ this.label11.Name = "label11";
+ this.label11.Size = new System.Drawing.Size(50, 13);
+ this.label11.TabIndex = 34;
+ this.label11.Text = "Statistic:";
+ //
+ // angleHistogram1
+ //
+ this.angleHistogram1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(76)))), ((int)(((byte)(76)))));
+ this.angleHistogram1.Font = new System.Drawing.Font("Segoe UI", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.angleHistogram1.Location = new System.Drawing.Point(6, 308);
+ this.angleHistogram1.Name = "angleHistogram1";
+ this.angleHistogram1.Size = new System.Drawing.Size(260, 195);
+ this.angleHistogram1.TabIndex = 27;
+ this.angleHistogram1.Text = "angleHistogram1";
+ //
+ // StatisticView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.DimGray;
+ this.Controls.Add(this.label20);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.lbNumSeg);
+ this.Controls.Add(this.lbNumSeg2);
+ this.Controls.Add(this.lbNumTri);
+ this.Controls.Add(this.lbNumTri2);
+ this.Controls.Add(this.lbNumVert);
+ this.Controls.Add(this.lbNumVert2);
+ this.Controls.Add(this.label32);
+ this.Controls.Add(this.label13);
+ this.Controls.Add(this.label31);
+ this.Controls.Add(this.label12);
+ this.Controls.Add(this.label16);
+ this.Controls.Add(this.label29);
+ this.Controls.Add(this.label14);
+ this.Controls.Add(this.lbAngleMax);
+ this.Controls.Add(this.lbQualAspectAve);
+ this.Controls.Add(this.lbEdgeMax);
+ this.Controls.Add(this.lbQualAlphaAve);
+ this.Controls.Add(this.lbAreaMax);
+ this.Controls.Add(this.lbAngleMin);
+ this.Controls.Add(this.lbQualAspectMin);
+ this.Controls.Add(this.lbEdgeMin);
+ this.Controls.Add(this.lbQualAlphaMin);
+ this.Controls.Add(this.lbAreaMin);
+ this.Controls.Add(this.label22);
+ this.Controls.Add(this.label10);
+ this.Controls.Add(this.label17);
+ this.Controls.Add(this.label21);
+ this.Controls.Add(this.label11);
+ this.Controls.Add(this.angleHistogram1);
+ this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.ForeColor = System.Drawing.Color.DarkGray;
+ this.Name = "StatisticView";
+ this.Size = new System.Drawing.Size(272, 509);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label20;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label lbNumSeg;
+ private System.Windows.Forms.Label lbNumSeg2;
+ private System.Windows.Forms.Label lbNumTri;
+ private System.Windows.Forms.Label lbNumTri2;
+ private System.Windows.Forms.Label lbNumVert;
+ private System.Windows.Forms.Label lbNumVert2;
+ private System.Windows.Forms.Label label32;
+ private System.Windows.Forms.Label label13;
+ private System.Windows.Forms.Label label31;
+ private System.Windows.Forms.Label label12;
+ private System.Windows.Forms.Label label16;
+ private System.Windows.Forms.Label label29;
+ private System.Windows.Forms.Label label14;
+ private System.Windows.Forms.Label lbAngleMax;
+ private System.Windows.Forms.Label lbQualAspectAve;
+ private System.Windows.Forms.Label lbEdgeMax;
+ private System.Windows.Forms.Label lbQualAlphaAve;
+ private System.Windows.Forms.Label lbAreaMax;
+ private System.Windows.Forms.Label lbAngleMin;
+ private System.Windows.Forms.Label lbQualAspectMin;
+ private System.Windows.Forms.Label lbEdgeMin;
+ private System.Windows.Forms.Label lbQualAlphaMin;
+ private System.Windows.Forms.Label lbAreaMin;
+ private System.Windows.Forms.Label label22;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.Label label17;
+ private System.Windows.Forms.Label label21;
+ private System.Windows.Forms.Label label11;
+ private Controls.AngleHistogram angleHistogram1;
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/StatisticView.cs b/Triangle.NET/TestApp/Views/StatisticView.cs
new file mode 100644
index 0000000..aa85c79
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/StatisticView.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using TriangleNet;
+using TriangleNet.Tools;
+using TriangleNet.Geometry;
+
+namespace MeshExplorer.Views
+{
+ public partial class StatisticView : UserControl, IView
+ {
+ Statistic statistic = new Statistic();
+ QualityMeasure quality;
+
+ public Statistic Statistic
+ {
+ get { return statistic; }
+ }
+
+ public StatisticView()
+ {
+ InitializeComponent();
+ }
+
+ public void UpdateStatistic(Mesh mesh)
+ {
+ statistic.Update(mesh, 10);
+ }
+
+ #region IView
+
+ public void HandleNewInput(InputGeometry geometry)
+ {
+ // Reset labels
+ lbNumVert2.Text = "-";
+ lbNumTri2.Text = "-";
+ lbNumSeg2.Text = "-";
+
+ lbNumVert.Text = geometry.Count.ToString();
+ lbNumSeg.Text = geometry.Segments.Count().ToString();
+ lbNumTri.Text = "0";
+
+ // Statistics labels
+ lbAreaMin.Text = "-";
+ lbAreaMax.Text = "-";
+ lbEdgeMin.Text = "-";
+ lbEdgeMax.Text = "-";
+ lbAngleMin.Text = "-";
+ lbAngleMax.Text = "-";
+
+ // Quality labels
+ lbQualAlphaMin.Text = "-";
+ lbQualAlphaAve.Text = "-";
+ lbQualAspectMin.Text = "-";
+ lbQualAspectAve.Text = "-";
+
+ angleHistogram1.SetData(null, null);
+ }
+
+ public void HandleMeshImport(InputGeometry geometry, Mesh mesh)
+ {
+ // Previous mesh stats
+ lbNumVert2.Text = "-";
+ lbNumTri2.Text = "-";
+ lbNumSeg2.Text = "-";
+ }
+
+ public void HandleMeshUpdate(Mesh mesh)
+ {
+ // Previous mesh stats
+ lbNumVert2.Text = lbNumVert.Text;
+ lbNumTri2.Text = lbNumTri.Text;
+ lbNumSeg2.Text = lbNumSeg.Text;
+ }
+
+ public void HandleMeshChange(Mesh mesh)
+ {
+ // New mesh stats
+ lbNumVert.Text = statistic.Vertices.ToString();
+ lbNumSeg.Text = statistic.ConstrainedEdges.ToString();
+ lbNumTri.Text = statistic.Triangles.ToString();
+
+ // Update statistics tab
+ angleHistogram1.SetData(statistic.MinAngleHistogram, statistic.MaxAngleHistogram);
+
+ lbAreaMin.Text = Util.DoubleToString(statistic.SmallestArea);
+ lbAreaMax.Text = Util.DoubleToString(statistic.LargestArea);
+ lbEdgeMin.Text = Util.DoubleToString(statistic.ShortestEdge);
+ lbEdgeMax.Text = Util.DoubleToString(statistic.LongestEdge);
+ lbAngleMin.Text = Util.AngleToString(statistic.SmallestAngle);
+ lbAngleMax.Text = Util.AngleToString(statistic.LargestAngle);
+
+ // Update quality
+ if (quality == null)
+ {
+ quality = new QualityMeasure();
+ }
+
+ quality.Update(mesh);
+
+ lbQualAlphaMin.Text = Util.DoubleToString(quality.AlphaMinimum);
+ lbQualAlphaAve.Text = Util.DoubleToString(quality.AlphaAverage);
+
+ lbQualAspectMin.Text = Util.DoubleToString(quality.Q_Minimum);
+ lbQualAspectAve.Text = Util.DoubleToString(quality.Q_Average);
+ }
+
+ #endregion
+ }
+}
diff --git a/Triangle.NET/TestApp/Views/StatisticView.resx b/Triangle.NET/TestApp/Views/StatisticView.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/Triangle.NET/TestApp/Views/StatisticView.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Triangle.NET/Triangle.sln b/Triangle.NET/Triangle.sln
index 5267097..f00acb1 100644
--- a/Triangle.NET/Triangle.sln
+++ b/Triangle.NET/Triangle.sln
@@ -5,9 +5,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle", "Triangle\Triang
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mesh Explorer", "TestApp\Mesh Explorer.csproj", "{336AAF8A-5316-4303-9E73-5E38BD0B28AF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeshRenderer.Core", "MeshRenderer.Core\MeshRenderer.Core.csproj", "{9C5040DA-C739-43A1-8540-E6BD3ED6DB55}"
+EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
- SccNumberOfProjects = 3
+ SccNumberOfProjects = 4
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs06
SccLocalPath0 = .
@@ -17,6 +19,9 @@ Global
SccProjectUniqueName2 = TestApp\\Mesh\u0020Explorer.csproj
SccProjectName2 = TestApp
SccLocalPath2 = TestApp
+ SccProjectUniqueName3 = MeshRenderer.Core\\MeshRenderer.Core.csproj
+ SccProjectName3 = MeshRenderer.Core
+ SccLocalPath3 = MeshRenderer.Core
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -47,6 +52,16 @@ Global
{336AAF8A-5316-4303-9E73-5E38BD0B28AF}.Release|Mixed Platforms.Build.0 = Release|x86
{336AAF8A-5316-4303-9E73-5E38BD0B28AF}.Release|x86.ActiveCfg = Release|x86
{336AAF8A-5316-4303-9E73-5E38BD0B28AF}.Release|x86.Build.0 = Release|x86
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {9C5040DA-C739-43A1-8540-E6BD3ED6DB55}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Triangle.NET/Triangle/Tools/IVoronoi.cs b/Triangle.NET/Triangle/Tools/IVoronoi.cs
new file mode 100644
index 0000000..f534589
--- /dev/null
+++ b/Triangle.NET/Triangle/Tools/IVoronoi.cs
@@ -0,0 +1,20 @@
+// -----------------------------------------------------------------------
+//
+// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/
+//
+// -----------------------------------------------------------------------
+
+namespace TriangleNet.Tools
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ ///
+ /// TODO: Update summary.
+ ///
+ public interface IVoronoi
+ {
+ }
+}
diff --git a/Triangle.NET/Triangle/Triangle.csproj b/Triangle.NET/Triangle/Triangle.csproj
index b0ccecb..c4a7680 100644
--- a/Triangle.NET/Triangle/Triangle.csproj
+++ b/Triangle.NET/Triangle/Triangle.csproj
@@ -83,6 +83,7 @@
+