internal CubicBezierCurve(Point[] points, int intervals, IPointCalculator pointCalculator, IPolygonAnalyser polygonAnalyser, IInputAnalyser inputAnalyser) { _pointCalculator = pointCalculator; _polygonAnalyser = polygonAnalyser; _inputAnalyser = inputAnalyser; _points = new List <Point>(); if (!_inputAnalyser.IsValidInput(points, intervals)) { throw new ArgumentException("Invalid input"); } if (!_polygonAnalyser.IsControlPolygon(points)) { throw new ArgumentException("Points entered do not form a control polygon", nameof(points)); } for (var ndx = 0; ndx < intervals + 1; ndx++) { var t = (float)ndx / (float)intervals; var curvePoint = _pointCalculator.Calculate(points, t); _points.Add(curvePoint); Points = _points.ToArray(); } }
public Model() { conf = new Configuration(); playersWithPoints = conf.GetDictionnaryOfPlayersWithPoints(); lib = new KaartenAdapter(); calc = new PointCalculator(); controller = new Controller(this); activeView = new OpstartMenu(this, controller); activeView.SetVisible(true); }
public void SetPointsLost(IPointCalculator calculator) { PointLost = calculator.CalculatePointsLost(); }
public void SetPointsTaken(IPointCalculator calculator) { PointsTaken = calculator.CalculatePointsTaken(); }
public MortalKombatWinnerSpecification(int roundsWin, int roundsLost, IPointCalculator calculator) { RoundsWin = roundsWin; RoundsLost = roundsLost; Calculator = calculator; }
public static Transaction MakeNewAmountTransaction(Customer owner, float amount, float ppa, float pm, string remark, IPointCalculator calculator) { if (amount <= 0) { throw new Exception("amount is less than or equal zero"); } if (owner == null) { throw new Exception("owner is null"); } float pointPerAmount = ppa; float pointMultipler = pm; int transactionPoint = calculator.CalculatePoint(amount); var newTransaction = new Transaction() { Amount = amount, Point = transactionPoint, PointPerAmount = pointPerAmount, PointMultiplier = pointMultipler, Customer = owner, //attach to new customer Remark = remark ?? "", RecordTime = DateTime.Now }; return(newTransaction); }