private static MyPoint2D MutatePoint(MyPoint2D pointToMutate) { MyPoint2D pointAfterMutate = new MyPoint2D(); double xAfterMutation = pointToMutate.GetX() + RANDOM.Next(-MUTATION_RANGE, MUTATION_RANGE); double yAfterMutation = pointToMutate.GetY() + RANDOM.Next(-MUTATION_RANGE, MUTATION_RANGE); pointAfterMutate.SetX(xAfterMutation < 0 ? 0 : xAfterMutation > 100 ? 100 : xAfterMutation); pointAfterMutate.SetY(yAfterMutation < 0 ? 0 : yAfterMutation > 100 ? 100 : yAfterMutation); pointAfterMutate.SetFunctionValue(SinusFunctionChartLogic.Function(xAfterMutation, yAfterMutation)); return(pointAfterMutate); }
public MyPoint2D(double x, double y) { this.x = x; this.y = y; functionValue = SinusFunctionChartLogic.Function(x, y); }