/// <summary> /// Renumber vertex and triangle id's. /// </summary> public void Renumber(NodeNumbering num) { // Don't need to do anything if the nodes are already numbered. if (num == this.numbering) { return; } int id; if (num == NodeNumbering.Linear) { id = 0; foreach (var node in this.vertices.Values) { node.id = id++; } } else if (num == NodeNumbering.CuthillMcKee) { CuthillMcKee rcm = new CuthillMcKee(); int[] perm_inv = rcm.Renumber(this); // Permute the node indices. foreach (var node in this.vertices.Values) { node.id = perm_inv[node.id]; } } // Remember the current numbering. numbering = num; // Triangles will always be numbered from 0 to n-1 id = 0; foreach (var item in this.triangles.Values) { item.id = id++; } }
/// <summary> /// Smooth the current mesh. /// </summary> public void Smooth() { numbering = NodeNumbering.None; ISmoother smoother = new SimpleSmoother(this); smoother.Smooth(); }
/// <summary> /// Reset the mesh triangulation state. /// </summary> private void Reset() { numbering = NodeNumbering.None; undeads = 0; // No eliminated input vertices yet. checksegments = false; // There are no segments in the triangulation yet. checkquality = false; // The quality triangulation stage has not begun. Statistic.InCircleCount = 0; Statistic.CounterClockwiseCount = 0; Statistic.InCircleCountDecimal = 0; Statistic.CounterClockwiseCountDecimal = 0; Statistic.Orient3dCount = 0; Statistic.HyperbolaCount = 0; Statistic.CircleTopCount = 0; Statistic.CircumcenterCount = 0; }