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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        public ManifoldDrawOperation(Player p, Command cmd)
            : base(p)
        {
            _expressions = PrepareParametrizedManifold.GetPlayerParametrizationCoordsStorage(p);
            if (null == _expressions[0])
            {
                throw new InvalidExpressionException("x is undefined");
            }
            if (null == _expressions[1])
            {
                throw new InvalidExpressionException("y is undefined");
            }
            if (null == _expressions[2])
            {
                throw new InvalidExpressionException("z is undefined");
            }

            _paramIterations = PrepareParametrizedManifold.GetPlayerParametrizationParamsStorage(p);
            if (null == _paramIterations[0] && null == _paramIterations[1] && null == _paramIterations[2])
            {
                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());
        }
Beispiel #6
0
        public StartSpringDraw(Player p, Command cmd)
            : base(p)
        {
            _expressions2 = PrepareParametrizedManifold.GetPlayerParametrizationCoordsStorage(p);
            if (null == _expressions2[0])
            {
                throw new InvalidExpressionException("x is undefined");
            }
            if (null == _expressions2[1])
            {
                throw new InvalidExpressionException("y is undefined");
            }
            if (null == _expressions2[2])
            {
                throw new InvalidExpressionException("z is undefined");
            }

            _paramIterations2 = PrepareParametrizedManifold.GetPlayerParametrizationParamsStorage(p);
            if (null == _paramIterations2[0] && null == _paramIterations2[1] && null == _paramIterations2[2])
            {
                throw new InvalidExpressionException("all parametrization variables are undefined");
            }

            if (GetNumOfSteps2(0) * GetNumOfSteps2(1) * GetNumOfSteps2(2) > MaxIterationSteps2)
            {
                throw new InvalidExpressionException("too many iteration steps (over " + MaxIterationSteps2 + ")");
            }

            _scaler2 = new Scaler(cmd.Next());
        }
        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 ManifoldDrawOperation(Player p, CommandReader cmd) : base (p)
		{
			_expressions = PrepareParametrizedManifold.GetPlayerParametrizationCoordsStorage(p);
			if (null == _expressions[0])
				throw new InvalidExpressionException("x is undefined");
			if (null == _expressions[1])
				throw new InvalidExpressionException("y is undefined");
			if (null == _expressions[2])
				throw new InvalidExpressionException("z is undefined");

			_paramIterations = PrepareParametrizedManifold.GetPlayerParametrizationParamsStorage(p);
			if (null==_paramIterations[0] && null==_paramIterations[1] && null==_paramIterations[2])
				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());
		}