/// <summary> /// Apply quality constraints to a mesh. /// </summary> /// <param name="quality">The quality constraints.</param> /// <param name="delaunay">A value indicating, if the refined mesh should be Conforming Delaunay.</param> public void Apply(QualityOptions quality, bool delaunay = false) { // Copy quality options if (quality != null) { behavior.Quality = true; behavior.MinAngle = quality.MinimumAngle; behavior.MaxAngle = quality.MaximumAngle; behavior.MaxArea = quality.MaximumArea; behavior.UserTest = quality.UserTest; behavior.VarArea = quality.VariableArea; behavior.ConformingDelaunay = behavior.ConformingDelaunay || delaunay; mesh.steinerleft = quality.SteinerPoints == 0 ? -1 : quality.SteinerPoints; } // TODO: remove if (!behavior.Poly) { // Be careful not to allocate space for element area constraints that // will never be assigned any value (other than the default -1.0). behavior.VarArea = false; } // Ensure that no vertex can be mistaken for a triangular bounding // box vertex in insertvertex(). mesh.infvertex1 = null; mesh.infvertex2 = null; mesh.infvertex3 = null; if (behavior.useSegments) { mesh.checksegments = true; } if (behavior.Quality && mesh.triangles.Count > 0) { // Enforce angle and area constraints. EnforceQuality(); } }
/// <inheritdoc /> public IMesh Triangulate(IPolygon polygon, QualityOptions quality) { return(Triangulate(polygon, null, quality)); }