diff --git a/Triangle.NET/TestApp/FormMain.Designer.cs b/Triangle.NET/TestApp/FormMain.Designer.cs
index fa68f8d..ac0e044 100644
--- a/Triangle.NET/TestApp/FormMain.Designer.cs
+++ b/Triangle.NET/TestApp/FormMain.Designer.cs
@@ -28,7 +28,7 @@
///
private void InitializeComponent()
{
- this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.splitContainer = new System.Windows.Forms.SplitContainer();
this.btnSmooth = new MeshExplorer.Controls.DarkButton();
this.flatTabControl1 = new MeshExplorer.Controls.DarkTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
@@ -52,14 +52,14 @@
this.menuTools = new System.Windows.Forms.ToolStripMenuItem();
this.menuToolsGen = new System.Windows.Forms.ToolStripMenuItem();
this.menuToolsCheck = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
+ this.menuToolsTopology = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.menuToolsRcm = new System.Windows.Forms.ToolStripMenuItem();
this.btnMesh = new MeshExplorer.Controls.DarkButton();
- this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
- this.menuToolsTopology = new System.Windows.Forms.ToolStripMenuItem();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
- this.splitContainer1.Panel1.SuspendLayout();
- this.splitContainer1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
+ this.splitContainer.Panel1.SuspendLayout();
+ this.splitContainer.SuspendLayout();
this.flatTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
@@ -67,30 +67,30 @@
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
- // splitContainer1
+ // splitContainer
//
- this.splitContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
- this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
- this.splitContainer1.IsSplitterFixed = true;
- this.splitContainer1.Location = new System.Drawing.Point(0, 0);
- this.splitContainer1.Name = "splitContainer1";
+ this.splitContainer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68)))));
+ this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+ this.splitContainer.IsSplitterFixed = true;
+ this.splitContainer.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer.Name = "splitContainer";
//
- // splitContainer1.Panel1
+ // splitContainer.Panel1
//
- this.splitContainer1.Panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(76)))), ((int)(((byte)(76)))));
- this.splitContainer1.Panel1.Controls.Add(this.btnSmooth);
- this.splitContainer1.Panel1.Controls.Add(this.flatTabControl1);
- this.splitContainer1.Panel1.Controls.Add(this.menuStrip1);
- this.splitContainer1.Panel1.Controls.Add(this.btnMesh);
+ this.splitContainer.Panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(76)))), ((int)(((byte)(76)))));
+ this.splitContainer.Panel1.Controls.Add(this.btnSmooth);
+ this.splitContainer.Panel1.Controls.Add(this.flatTabControl1);
+ this.splitContainer.Panel1.Controls.Add(this.menuStrip1);
+ this.splitContainer.Panel1.Controls.Add(this.btnMesh);
//
- // splitContainer1.Panel2
+ // splitContainer.Panel2
//
- this.splitContainer1.Panel2.BackColor = System.Drawing.Color.Black;
- this.splitContainer1.Size = new System.Drawing.Size(984, 612);
- this.splitContainer1.SplitterDistance = 280;
- this.splitContainer1.SplitterWidth = 1;
- this.splitContainer1.TabIndex = 0;
+ this.splitContainer.Panel2.BackColor = System.Drawing.Color.Black;
+ this.splitContainer.Size = new System.Drawing.Size(992, 623);
+ this.splitContainer.SplitterDistance = 280;
+ this.splitContainer.SplitterWidth = 1;
+ this.splitContainer.TabIndex = 0;
//
// btnSmooth
//
@@ -310,6 +310,18 @@
this.menuToolsCheck.Text = "Check Mesh";
this.menuToolsCheck.Click += new System.EventHandler(this.menuToolsCheck_Click);
//
+ // toolStripSeparator5
+ //
+ this.toolStripSeparator5.Name = "toolStripSeparator5";
+ this.toolStripSeparator5.Size = new System.Drawing.Size(192, 6);
+ //
+ // menuToolsTopology
+ //
+ this.menuToolsTopology.Name = "menuToolsTopology";
+ this.menuToolsTopology.Size = new System.Drawing.Size(195, 22);
+ this.menuToolsTopology.Text = "Topology Explorer";
+ this.menuToolsTopology.Click += new System.EventHandler(this.menuToolsTopology_Click);
+ //
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
@@ -334,26 +346,14 @@
this.btnMesh.UseVisualStyleBackColor = true;
this.btnMesh.Click += new System.EventHandler(this.btnMesh_Click);
//
- // toolStripSeparator5
- //
- this.toolStripSeparator5.Name = "toolStripSeparator5";
- this.toolStripSeparator5.Size = new System.Drawing.Size(192, 6);
- //
- // menuToolsTopology
- //
- this.menuToolsTopology.Name = "menuToolsTopology";
- this.menuToolsTopology.Size = new System.Drawing.Size(195, 22);
- this.menuToolsTopology.Text = "Topology Explorer";
- this.menuToolsTopology.Click += new System.EventHandler(this.menuToolsTopology_Click);
- //
// 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)))));
- this.ClientSize = new System.Drawing.Size(984, 612);
- this.Controls.Add(this.splitContainer1);
+ this.ClientSize = new System.Drawing.Size(992, 623);
+ this.Controls.Add(this.splitContainer);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
@@ -367,10 +367,10 @@
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();
- ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
- this.splitContainer1.ResumeLayout(false);
+ this.splitContainer.Panel1.ResumeLayout(false);
+ this.splitContainer.Panel1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
+ this.splitContainer.ResumeLayout(false);
this.flatTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
@@ -383,7 +383,7 @@
#endregion
- private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem menuFile;
private System.Windows.Forms.ToolStripMenuItem menuFileOpen;
diff --git a/Triangle.NET/TestApp/FormMain.cs b/Triangle.NET/TestApp/FormMain.cs
index 13e8f2f..f3d3fce 100644
--- a/Triangle.NET/TestApp/FormMain.cs
+++ b/Triangle.NET/TestApp/FormMain.cs
@@ -72,10 +72,10 @@ namespace MeshExplorer
private void InitializeRenderControl(Control control)
{
- this.splitContainer1.SuspendLayout();
- this.splitContainer1.Panel2.Controls.Add(control);
+ this.splitContainer.SuspendLayout();
+ this.splitContainer.Panel2.Controls.Add(control);
- var size = this.splitContainer1.Panel2.ClientRectangle;
+ var size = this.splitContainer.Panel2.ClientRectangle;
// Initialize control
control.BackColor = Color.Black;
@@ -87,7 +87,21 @@ namespace MeshExplorer
control.TabIndex = 0;
control.Text = "renderControl1";
- this.splitContainer1.ResumeLayout();
+ this.splitContainer.ResumeLayout();
+ }
+
+ protected override void OnMouseWheel(MouseEventArgs e)
+ {
+ if (splitContainer.Panel2.Bounds.Contains(e.Location))
+ {
+ var control = renderManager.Control as Control;
+
+ // Set focus on the render control.
+ if (control != null && !control.Focused)
+ {
+ control.Focus();
+ }
+ }
}
private void Form1_KeyUp(object sender, KeyEventArgs e)
@@ -176,11 +190,6 @@ namespace MeshExplorer
#endregion
- protected override void OnMouseWheel(MouseEventArgs e)
- {
- // TODO: focus render control
- }
-
#region Resize event handler
bool isResizing = false;
@@ -536,7 +545,7 @@ namespace MeshExplorer
try
{
- mesh.Refine(quality);
+ mesh.Refine(quality, meshControlView.ParamConformDelChecked);
statisticView.UpdateStatistic(mesh);
diff --git a/Triangle.NET/Triangle/Mesh.cs b/Triangle.NET/Triangle/Mesh.cs
index 24d24ea..ad2deb2 100644
--- a/Triangle.NET/Triangle/Mesh.cs
+++ b/Triangle.NET/Triangle/Mesh.cs
@@ -257,7 +257,7 @@ namespace TriangleNet
this.locator = new TriangleLocator(this, predicates);
}
- public void Refine(QualityOptions quality)
+ public void Refine(QualityOptions quality, bool delaunay = false)
{
invertices = vertices.Count;
@@ -268,8 +268,13 @@ namespace TriangleNet
Reset();
+ if (qualityMesher == null)
+ {
+ qualityMesher = new QualityMesher(this, new Configuration());
+ }
+
// Enforce angle and area constraints.
- qualityMesher.Apply(quality);
+ qualityMesher.Apply(quality, delaunay);
}
///
diff --git a/Triangle.NET/Triangle/Meshing/ConstraintOptions.cs b/Triangle.NET/Triangle/Meshing/ConstraintOptions.cs
index d78c920..4325b3a 100644
--- a/Triangle.NET/Triangle/Meshing/ConstraintOptions.cs
+++ b/Triangle.NET/Triangle/Meshing/ConstraintOptions.cs
@@ -6,9 +6,12 @@ namespace TriangleNet.Meshing
///
public class ConstraintOptions
{
+ // TODO: remove ConstraintOptions.UseRegions
+
///
/// Gets or sets a value indicating whether to use regions.
///
+ [System.Obsolete("Not used anywhere, will be removed in beta 4.")]
public bool UseRegions { get; set; }
///
diff --git a/Triangle.NET/Triangle/Meshing/IMesh.cs b/Triangle.NET/Triangle/Meshing/IMesh.cs
index 7a769dd..f5fb484 100644
--- a/Triangle.NET/Triangle/Meshing/IMesh.cs
+++ b/Triangle.NET/Triangle/Meshing/IMesh.cs
@@ -48,6 +48,10 @@ namespace TriangleNet.Meshing
///
/// Refine the mesh.
///
- void Refine(QualityOptions quality);
+ /// The quality constraints.
+ ///
+ /// A value indicating, if the refined mesh should be Conforming Delaunay.
+ ///
+ void Refine(QualityOptions quality, bool delaunay);
}
}
diff --git a/Triangle.NET/Triangle/Meshing/QualityMesher.cs b/Triangle.NET/Triangle/Meshing/QualityMesher.cs
index b389813..1976e9d 100644
--- a/Triangle.NET/Triangle/Meshing/QualityMesher.cs
+++ b/Triangle.NET/Triangle/Meshing/QualityMesher.cs
@@ -56,7 +56,8 @@ namespace TriangleNet.Meshing
/// Apply quality constraints to a mesh.
///
/// The quality constraints.
- public void Apply(QualityOptions quality)
+ /// A value indicating, if the refined mesh should be Conforming Delaunay.
+ public void Apply(QualityOptions quality, bool delaunay = false)
{
// Copy quality options
if (quality != null)
@@ -69,6 +70,8 @@ namespace TriangleNet.Meshing
behavior.UserTest = quality.UserTest;
behavior.VarArea = quality.VariableArea;
+ behavior.ConformingDelaunay = behavior.ConformingDelaunay || delaunay;
+
mesh.steinerleft = quality.SteinerPoints == 0 ? -1 : quality.SteinerPoints;
}
diff --git a/Triangle.NET/Triangle/Tools/AdjacencyMatrix.cs b/Triangle.NET/Triangle/Tools/AdjacencyMatrix.cs
index 7c4d7c8..6cabe33 100644
--- a/Triangle.NET/Triangle/Tools/AdjacencyMatrix.cs
+++ b/Triangle.NET/Triangle/Tools/AdjacencyMatrix.cs
@@ -56,6 +56,8 @@ namespace TriangleNet.Tools
// Set up the adj adjacency array.
this.irow = AdjacencySet(mesh, this.pcol);
+
+ SortIndices();
}
public AdjacencyMatrix(int[] pcol, int[] irow)
@@ -260,17 +262,22 @@ namespace TriangleNet.Tools
}
}
- int k1, k2;
+ return list;
+ }
+
+ public void SortIndices()
+ {
+ int k1, k2, n = N;
+
+ int[] list = this.irow;
// Ascending sort the entries for each column.
- for (i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
k1 = pcol[i];
k2 = pcol[i + 1];
Array.Sort(list, k1, k2 - k1);
}
-
- return list;
}
#endregion