private void IntersectSurfaces() { List <Vector4> intersection = null; IIntersectable first = null; IIntersectable second = null; bool cyclic = false; try { var selected = models.Where(x => x.IsSelected).ToList(); var sel = selected.Select(x => x as IIntersectable).Distinct().ToList(); if (sel.Count == 2) { first = sel[0]; second = sel[1]; if (first != null && second != null) { intersection = Intersection.Intersect(sel[0], sel[1], this, NewtonStep, out cyclic); } } } catch (Exception e) { intersection = null; } if (intersection != null && intersection.Count > 2) { //intersection.ForEach(x => CreateHiddenCatPoint(sel[0].GetPosition(x.X, x.Y))); var curv = new GeometryModels.CuttingCurve(intersection, first, second, this, cyclic, CuttingCurveApproximation); AddNewModel(curv); first.SetCuttingCurve(curv); second.SetCuttingCurve(curv); } else { var sampleMessageDialog = new MessageHost { Message = { Text = "Proper intersection could not be found." } }; DialogHost.Show(sampleMessageDialog, "RootDialog"); } }