public bool TryCatchPoint(Point location) { int precision = 5; EditablePoint point = data.Points.Find(x => x.X - precision <location.X && x.X + precision> location.X && x.Y - precision <location.Y && x.Y + precision> location.Y); if (point == null) { return(false); } index = data.Points.FindIndex(x => x.X == point.X && x.Y == point.Y); return(true); }
public bool TryNewPoint(EditablePoint location) { //if (data.Points.Count == 20) //{ // MessageBox.Show("Number of points cannot be greater than 20"); // return false; //} //not needed since Newton function was changed int precision = 5; if (data.Points.Find(x => x.X - precision < location.X && x.X + precision > location.X && x.Y - precision < location.Y && x.Y + precision > location.Y) != null) { return(false); } data.Points.Add(location); return(true); }