protected FuncDrawOperation(Player player, Command cmd) : base(player) { string strFunc = cmd.Next(); if (string.IsNullOrWhiteSpace(strFunc)) { player.Message("&WEmpty function expression"); return; } if (strFunc.Length < 3) { player.Message("&WExpression is too short(should be like z=f(x,y))"); return; } strFunc = strFunc.ToLower(); Vaxis = GetAxis(SimpleParser.PreparseAssignment(ref strFunc)); _Expression = SimpleParser.Parse(strFunc, GetVarArray(Vaxis)); Player.Message("Expression parsed as " + _Expression.Print()); string scalingStr = cmd.Next(); _Scaler = new Scaler(scalingStr); }
public InequalityDrawOperation(Player player, Command cmd) : base(player) { string strFunc = cmd.Next(); if (String.IsNullOrWhiteSpace(strFunc)) { throw new ArgumentException("empty inequality expression"); } if (strFunc.Length < 3) { throw new ArgumentException("expression is too short(should be like f(x,y,z)>g(x,y,z))"); } strFunc = strFunc.ToLower(); _Expression = SimpleParser.Parse(strFunc, new string[] { "x", "y", "z" }); if (!_Expression.IsInEquality()) { throw new ArgumentException("the expression given is not an inequality(should be like f(x,y,z)>g(x,y,z))"); } Player.Message("Expression parsed as " + _Expression.Print()); string scalingStr = cmd.Next(); _Scaler = new Scaler(scalingStr); }
public EqualityDrawOperation(Player player, Command cmd) : base(player) { string strFunc = cmd.Next(); if (string.IsNullOrWhiteSpace(strFunc)) { player.Message("empty equality expression"); return; } if (strFunc.Length < 3) { player.Message("expression is too short(should be like f(x,y,z)=g(x,y,z))"); return; } strFunc = strFunc.ToLower(); _Expression = SimpleParser.ParseAsEquality(strFunc, new string[] { "x", "y", "z" }); Player.Message("Expression parsed as " + _Expression.Print()); string scalingStr = cmd.Next(); _Scaler = new Scaler(scalingStr); }
public StartSpringDraw(Player p, Command cmd) : base(p) { Expressions = PrepareParametrizedManifold.GetPlayerParametrizationCoordsStorage(p); if (Expressions[0] == null) { throw new InvalidExpressionException("x is undefined"); } if (Expressions[1] == null) { throw new InvalidExpressionException("y is undefined"); } if (Expressions[2] == null) { throw new InvalidExpressionException("z is undefined"); } ParameterIterations = PrepareParametrizedManifold.GetPlayerParametrizationParamsStorage(p); if (ParameterIterations[0] == null && ParameterIterations[1] == null && ParameterIterations[2] == null) { throw new InvalidExpressionException("all parametrization variables are undefined"); } if (GetNumOfSteps2(0) * GetNumOfSteps2(1) * GetNumOfSteps2(2) > MaxIterationSteps) { throw new InvalidExpressionException("too many iteration steps(over " + MaxIterationSteps + ")"); } _Scaler = new Scaler(cmd.Next()); }
public ManifoldDrawOperation(Player p, Command cmd) : base(p) { _Expressions = PrepareParametrizedManifold.GetPlayerParametrizationCoordsStorage(p); if (_Expressions[0] == null) { throw new InvalidExpressionException("x is undefined"); } if (_Expressions[1] == null) { throw new InvalidExpressionException("y is undefined"); } if (_Expressions[2] == null) { throw new InvalidExpressionException("z is undefined"); } ParamIterations = PrepareParametrizedManifold.GetPlayerParametrizationParamsStorage(p); if (ParamIterations[0] == null && ParamIterations[1] == null && ParamIterations[2] == null) { throw new InvalidExpressionException("all parametrization variables are undefined"); } if (GetNumOfSteps(0) * GetNumOfSteps(1) * GetNumOfSteps(2) > MaxIterationSteps) { throw new InvalidExpressionException("too many iteration steps(over " + MaxIterationSteps + ")"); } _Scaler = new Scaler(cmd.Next()); p.Message("Going to draw the following parametrization:\nx=" + _Expressions[0].Print() + "\ny=" + _Expressions[1].Print() + "\nz=" + _Expressions[2].Print()); }