public double GetValue() { double inputX = InputBroker.GetInputValue(EditConsideration.Input); inputX = EditConsideration.NormalizeInput(inputX); return(EditConsideration.Curve.ComputeValue(inputX)); }
internal Scenario.Score Score(IInputBroker broker, Scenario.Context context) { var score = new Scenario.Score(); score.InputValue = broker.GetInputValue(Input, context); score.InputValue = NormalizeInput(score.InputValue); score.FinalScore = Curve.ComputeValue(score.InputValue); return(score); }
internal EditWidgetConsiderationScore(Consideration consideration, IInputBroker broker) { InitializeComponent(); EditConsideration = consideration; InputBroker = broker; ConsiderationNameLabel.Text = EditConsideration.ReadableName + " (0.0) x"; ResponseCurvePictureBox.Paint += (e, args) => { Point previousPoint = ConvertXYToPoint(0.0, EditConsideration.Curve.ComputeValue(0.0)); for (double x = 0.0; x <= 1.0; x += 0.001) { double y = EditConsideration.Curve.ComputeValue(x); Point p = ConvertXYToPoint(x, y); args.Graphics.DrawLine(Pens.Blue, previousPoint, p); previousPoint = p; } double inputX = InputBroker.GetInputValue(EditConsideration.Input); inputX = EditConsideration.NormalizeInput(inputX); double inputY = EditConsideration.Curve.ComputeValue(inputX); string name = EditConsideration.ReadableName; ConsiderationNameLabel.Text = $"{name} ({inputX:f3}) x"; ScoreLabel.Text = $"= {inputY:f3}"; Point offsetPoint = ConvertXYToPoint(inputX, inputY); offsetPoint.X -= 4; offsetPoint.Y -= 4; args.Graphics.FillEllipse(Brushes.Blue, new Rectangle(offsetPoint, new Size(8, 8))); }; }