コード例 #1
0
    void ToExpressionSet(ExpressionSet es)
    {
        //ExpressionSet es = new ExpressionSet();

        List <string> tokens = ExpressionParser.Parse(xInput.text);

        es.AddExpression("X", new Expression(tokens));
        tokens = ExpressionParser.Parse(yInput.text);
        es.AddExpression("Y", new Expression(tokens));
        tokens = ExpressionParser.Parse(zInput.text);
        es.AddExpression("Z", new Expression(tokens));

        if (uInput != null)
        {
            es.AddRange("u", ToRangePair(uInput.text));
        }
        if (vInput != null)
        {
            es.AddRange("v", ToRangePair(vInput.text));
        }
        if (wInput != null)
        {
            es.AddRange("w", ToRangePair(wInput.text));
        }
        if (tInput != null)
        {
            es.AddRange("t", ToRangePair(tInput.text));
        }

        //return es;
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        es = new ExpressionSet();
        es.expressions["X"].tokens = new List <string>
        {
            //2Pz
            //"(","1","/","4","*","1","/","2","^","(","1","/","2",")","*","1","/","pi","^","(","1","/","2",")",
            //"*","z","*","e","^","(","-","1","*","(","x","^","2","+","y","^","2","+","z","^","2",")","/","2",")",")","^","2"
            //3Pz
            "(", "2", "^", "(", "1", "/", "2", ")", "*", "1", "/", "8", "1", "*", "1", "/", "pi", "^", "(", "1", "/", "2", ")", "*",
            "(", "6", "-", "(", "x", "^", "2", "+", "y", "^", "2", "+", "z", "^", "2", ")", "^", "(", "1", "/", "2", ")", ")",
            "*", "z", "*", "e", "^", "(", "-", "1", "*", "(", "x", "^", "2", "+", "y", "^", "2", "+", "z", "^", "2", ")", "^", "(", "1", "/", "2", ")", "/", "3", ")", ")", "^", "2"
            //3Dz2
            //"(","1","/","81","*","1","/","6","^","(","1","/","2",")","*","1","/","pi","^","(","1","/","2",")",
            //"*","(","3","*","z","^","2","-","x","^","2","+","y","^","2","+","z","^","2",")",
            //"*","e","^","(","-","1","*","(","x","^","2","+","y","^","2","+","z","^","2",")","/","3",")",")","^","2"
        };
        es.expressions["Y"].tokens = new List <string>
        {
            "0"
        };
        es.expressions["Z"].tokens = new List <string>
        {
            "0"
        };
        es.AddRange("x");
        es.AddRange("y");
        es.AddRange("z");
        es.ranges["t"].Min.tokens = new List <string>
        {
            "-", "5", "0"
        };
        es.ranges["t"].Max.tokens = new List <string>
        {
            "5", "0"
        };
        densityPreset.Initialize(this);
        //print("START");
        // responder = new DensityKeyboardInputResponder(xInputbox, yInputbox, zInputbox, tminInput, tmaxInput);
        // keyboard.RegisterResponder(responder);

        //responder.initialize();
        //print(responder);
    }
コード例 #3
0
 public void initialize()
 {
     es = new ExpressionSet();
     es.expressions["X"].tokens = new List <string>
     {
         "y"
     };
     es.expressions["Y"].tokens = new List <string>
     {
         "-x"
     };
     es.expressions["Z"].tokens = new List <string>
     {
         "0"
     };
     es.ranges["t"].Min.tokens = new List <string>
     {
         "-", "5", "0"
     };
     es.ranges["t"].Max.tokens = new List <string>
     {
         "5", "0"
     };
     es.AddRange("x");
     es.AddRange("y");
     es.AddRange("z");
     currExpression = es.expressions["X"];
     currText       = xText;
     index          = currExpression.tokens.Count;
     isReady        = true;
     xText.text     = displayText(es.expressions["X"].tokens, es.expressions["X"].tokens.Count, false);
     yText.text     = displayText(es.expressions["Y"].tokens, es.expressions["Y"].tokens.Count, false);
     zText.text     = displayText(es.expressions["Z"].tokens, es.expressions["Z"].tokens.Count, false);
     tminText.text  = displayText(es.ranges["t"].Min.tokens, es.ranges["t"].Min.tokens.Count, false);
     tmaxText.text  = displayText(es.ranges["t"].Max.tokens, es.ranges["t"].Max.tokens.Count, false);
     currText.text  = displayText(currExpression.tokens, index, true);
 }
コード例 #4
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0.75*sin(2*pi*v)");
            y    = ExpressionParser.Parse("sin(pi*u)*(1.5+0.75*cos(2*pi*v))");
            z    = ExpressionParser.Parse("cos(pi*u)*(1.5+0.75*cos(2*pi*v))");
            umin = ExpressionParser.Parse("1.5");
            umax = ExpressionParser.Parse("2.5");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");

            List <string> x2    = ExpressionParser.Parse("0.75*cos(pi*u)");
            List <string> y2    = ExpressionParser.Parse("0.75*sin(pi*u)*cos(2*pi*v)+2.4");
            List <string> z2    = ExpressionParser.Parse("0.75*sin(pi*u)*sin(2*pi*v)+2.6");
            List <string> umin2 = ExpressionParser.Parse("0");
            List <string> umax2 = ExpressionParser.Parse("1");
            List <string> vmin2 = ExpressionParser.Parse("0");
            List <string> vmax2 = ExpressionParser.Parse("1");

            List <string> x3    = ExpressionParser.Parse("0.75*sin(2*pi*u)");
            List <string> y3    = ExpressionParser.Parse("0.75*cos(2*pi*u)+1.5*cos(pi/8*v)");
            List <string> z3    = ExpressionParser.Parse("-1.5*sin(pi/8*v)");
            List <string> umin3 = ExpressionParser.Parse("0");
            List <string> umax3 = ExpressionParser.Parse("1");
            List <string> vmin3 = ExpressionParser.Parse("0");
            List <string> vmax3 = ExpressionParser.Parse("1");

            List <string> x4    = ExpressionParser.Parse("0.75*sin(2*pi*u)");
            List <string> y4    = ExpressionParser.Parse("0.75*cos(2*pi*u)-1.5*cos(pi/8*v)");
            List <string> z4    = ExpressionParser.Parse("-1.5*sin(pi/8*v)");
            List <string> umin4 = ExpressionParser.Parse("0");
            List <string> umax4 = ExpressionParser.Parse("1");
            List <string> vmin4 = ExpressionParser.Parse("0");
            List <string> vmax4 = ExpressionParser.Parse("1");

            Expression X  = new Expression(x);
            Expression Y  = new Expression(y);
            Expression Z  = new Expression(z);
            Expression X2 = new Expression(x2);
            Expression Y2 = new Expression(y2);
            Expression Z2 = new Expression(z2);
            Expression X3 = new Expression(x3);
            Expression Y3 = new Expression(y3);
            Expression Z3 = new Expression(z3);
            Expression X4 = new Expression(x4);
            Expression Y4 = new Expression(y4);
            Expression Z4 = new Expression(z4);

            Range            zeroRange    = new Range(ExpressionParser.Parse("0"));
            Range            oneRange     = new Range(ExpressionParser.Parse("1"));
            Range            onePointFive = new Range(ExpressionParser.Parse("1.5"));
            Range            twoPointFive = new Range(ExpressionParser.Parse("2.5"));
            RangePair        zeroToZero   = new RangePair(zeroRange, zeroRange);
            RangePair        zeroToOne    = new RangePair(zeroRange, oneRange);
            List <RangePair> rangePairs   = new List <RangePair>()
            {
                zeroToZero, new RangePair(onePointFive, twoPointFive), zeroToOne, zeroToOne
            };
            List <RangePair> rangePairs2 = new List <RangePair>()
            {
                zeroToZero, zeroToOne, zeroToOne, zeroToZero
            };
            ExpressionSet expSet = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X, Y, Z
            });
            ExpressionSet expSet2 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X2, Y2, Z2
            });
            ExpressionSet expSet3 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X3, Y3, Z3
            });
            ExpressionSet expSet4 = new ExpressionSet(new string[] { "t", "u", "v", "w" }, rangePairs2, new string[] { "X", "Y", "Z" }, new List <Expression>()
            {
                X4, Y4, Z4
            });

            List <ExpressionSet> nanomeLogo = new List <ExpressionSet>()
            {
                expSet, expSet2, expSet3, expSet4
            };
            CalcManager.Instance.LoadSavedExpressionSets(nanomeLogo);
            print("unknown preset pressed");
            return;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        // Orbitals
        case "S":
            x    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Px":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Py":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Pz":
            x    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dz\x00B2":
            goto case "Dz2";

        case "Dz2":
            x    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dyz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxy":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dx\x00B2-y\x00B2":
            goto case "Dx2-y2";

        case "Dx2-y2":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x00B3":
            goto case "Fz3";

        case "Fz3":
            x    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxz\x00B2":
            goto case "Fxz2";

        case "Fxz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fyz\x00B2":
            goto case "Fyz2";

        case "Fyz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxyz":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x0028x\x00B2-y\x00B2\x0029":
            goto case "Fzx2y2";

        case "Fzx2y2":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fx\x0028x\x00B2-3y\x00B2\x0029":
            goto case "Fxx23y2";

        case "Fxx23y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fy\x00283x\x00B2-y\x00B2\x0029":
            goto case "Fy3x2y2";

        case "Fy3x2y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
コード例 #5
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;
        }

        expressionSet.AddExpression(ExpressionSet.ExpOptions.X, x);
        expressionSet.AddExpression(ExpressionSet.ExpOptions.Y, y);
        expressionSet.AddExpression(ExpressionSet.ExpOptions.Z, z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
コード例 #6
0
ファイル: PresetMenu.cs プロジェクト: factsfinder/calcflow
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = calcManager.expressionSet;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        //R1 -> R1
        case "Cinquefoil Knot":
            x    = ExpressionParser.Parse("cos(t)*(2-cos(2*t/5))");
            y    = ExpressionParser.Parse("sin(t)*(2-cos(2*t/5))");
            z    = ExpressionParser.Parse("-sin(2*t/5)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("10*pi");
            break;

        case "Circle":
            x    = ExpressionParser.Parse("cos(t)");
            y    = ExpressionParser.Parse("sin(t)");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "Sphere Outline":
            x    = ExpressionParser.Parse("sin(t)*cos(32*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(32*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        case "Hypocloid":
            x    = ExpressionParser.Parse("cos(t)^3");
            y    = ExpressionParser.Parse("sin(t)^3");
            z    = ExpressionParser.Parse("0");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Hypocloid Surface":
            x    = ExpressionParser.Parse("10*cos(t*32)^3");
            y    = ExpressionParser.Parse("10*sin(t*32)^3");
            z    = ExpressionParser.Parse("t-2*pi");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("4pi");
            break;

        case "Trefoil Knot":
            x    = ExpressionParser.Parse("sin(t)+2*sin(2*t)");
            y    = ExpressionParser.Parse("cos(t)-2*cos(2*t)");
            z    = ExpressionParser.Parse("-sin(3*t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2*pi");
            break;

        case "Turnip":
            x    = ExpressionParser.Parse("(sin(t/16)^2)*cos(8*t)*8*pi");
            y    = ExpressionParser.Parse("(sin(t/16))^2*sin(8*t)*8*pi");
            z    = ExpressionParser.Parse("8*pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("16pi");
            break;

        case "Wavy Surface":
            x    = ExpressionParser.Parse("(sin(t/2)^(1/2)*cos(256*t)*pi)");
            y    = ExpressionParser.Parse("(sin(t/2))^(1/2)*sin(64*t)*pi");
            z    = ExpressionParser.Parse("pi-t");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("2pi");
            break;

        case "High-res Sphere":
            x    = ExpressionParser.Parse("sin(t)*cos(1024*t)");
            y    = ExpressionParser.Parse("sin(t)*sin(1024*t)");
            z    = ExpressionParser.Parse("cos(t)");
            tmin = ExpressionParser.Parse("0");
            tmax = ExpressionParser.Parse("pi");
            break;

        //R2->R3
        case "Astroidal Ellipse":
            x    = ExpressionParser.Parse("(2*cos(u)*cos(v))^3");
            y    = ExpressionParser.Parse("(2*sin(u)*cos(v))^3");
            z    = ExpressionParser.Parse("(2*sin(v))^3");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Bumpy Sphere":
            x    = ExpressionParser.Parse("5*sin(u)*sin(v)+cos(30*v)*0.15");
            y    = ExpressionParser.Parse("5*cos(u)*sin(v)+cos(30*u)*0.15");
            z    = ExpressionParser.Parse("5*cos(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("pi");
            break;

        case "Dini's Surface":
            x    = ExpressionParser.Parse("3*cos(u)*sin(v)");
            y    = ExpressionParser.Parse("3*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("3*(cos(v)+log(tan(0.5*v)))+0.4*u");
            umin = ExpressionParser.Parse("-4*pi");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0.005");
            vmax = ExpressionParser.Parse("3.135");
            break;

        case "Figure-8":
            x    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*cos(u)");
            y    = ExpressionParser.Parse("(3+cos(u/2)*sin(v)-sin(u/2)*sin(2*v))*sin(u)");
            z    = ExpressionParser.Parse("sin(u/2)*sin(v)-cos(u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Gray's Surface":
            x    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*cos(u/2)");
            y    = ExpressionParser.Parse("(3+cos(3*u/2)*sin(v)-sin(3*u/2)*sin(2*v))*sin(u/2)");
            z    = ExpressionParser.Parse("sin(3*u/2)*sin(v)+cos(3*u/2)*sin(2*v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("4*pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Knot":
            x    = ExpressionParser.Parse("3*sin(3*u)/2+cos(v)))");
            y    = ExpressionParser.Parse("3*(sin(u)+2*sin(2*u))/(2+cos(v+pi*2/3))");
            z    = ExpressionParser.Parse("3/2*(cos(u)-2*cos(2*u))*(2+cos(v))*(2+cos(v+pi*2/3))/4");
            umin = ExpressionParser.Parse("-pi");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("-pi");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Mobius":
            x    = ExpressionParser.Parse("(5+u*cos(0.5*v))*cos(v)");
            y    = ExpressionParser.Parse("(5+u*cos(0.5*v))*sin(v)");
            z    = ExpressionParser.Parse("u*sin(0.5*v)");
            umin = ExpressionParser.Parse("-1");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2*pi");
            break;

        case "Radial Wave":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("cos((u^2+v^2)^0.5)");
            umin = ExpressionParser.Parse("-10");
            umax = ExpressionParser.Parse("10");
            vmin = ExpressionParser.Parse("-10");
            vmax = ExpressionParser.Parse("10");
            break;

        case "Torus":
            x    = ExpressionParser.Parse("(5+cos(v))*cos(u)");
            y    = ExpressionParser.Parse("(5+cos(v))*sin(u)");
            z    = ExpressionParser.Parse("sin(v)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("2pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        //R3->R3
        case "Cone":
            x    = ExpressionParser.Parse("ucos(v)w");
            y    = ExpressionParser.Parse("usin(v)w");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cube":
            x    = ExpressionParser.Parse("u");
            y    = ExpressionParser.Parse("v");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Cylinder":
            x    = ExpressionParser.Parse("ucos(v)");
            y    = ExpressionParser.Parse("usin(v)");
            z    = ExpressionParser.Parse("w");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        case "Sphere":
            x    = ExpressionParser.Parse("ucos(v)sin(w)");
            y    = ExpressionParser.Parse("usin(v)sin(w)");
            z    = ExpressionParser.Parse("ucos(w)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("2pi");
            break;

        case "Tetrahedron":
            x    = ExpressionParser.Parse("u(1-v)");
            y    = ExpressionParser.Parse("uv(1-w)");
            z    = ExpressionParser.Parse("uvw");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("1");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("1");
            wmin = ExpressionParser.Parse("0");
            wmax = ExpressionParser.Parse("1");
            break;

        // Orbitals
        case "S":
            x    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(1/2*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Px":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Py":
            x    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*sin(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Pz":
            x    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(3^(1/2)/2*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dz\x00B2":
            goto case "Dz2";

        case "Dz2":
            x    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(5^(1/2)/4*(3*((cos(u))^2)-1)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*sin(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dyz":
            x    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/2*sin(u)*cos(u)*1/pi^(1/2)*cos(v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dxy":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*sin(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Dx\x00B2-y\x00B2":
            goto case "Dx2-y2";

        case "Dx2-y2":
            x    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(15^(1/2)/4*sin(u)^2*1/pi^(1/2)*cos(2v))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x00B3":
            goto case "Fz3";

        case "Fz3":
            x    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(7^(1/2)/4*(5*((cos(u))^2)-3)*cos(u)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxz\x00B2":
            goto case "Fxz2";

        case "Fxz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*sin(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fyz\x00B2":
            goto case "Fyz2";

        case "Fyz2":
            x    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(42^(1/2)/8*(5*((cos(u))^2)-1)*sin(u)*cos(v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fxyz":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*cos(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fz\x0028x\x00B2-y\x00B2\x0029":
            goto case "Fzx2y2";

        case "Fzx2y2":
            x    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(105^(1/2)/4*sin(u)^2*cos(u)*sin(2v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fx\x0028x\x00B2-3y\x00B2\x0029":
            goto case "Fxx23y2";

        case "Fxx23y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*sin(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;

        case "Fy\x00283x\x00B2-y\x00B2\x0029":
            goto case "Fy3x2y2";

        case "Fy3x2y2":
            x    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*cos(v)");
            y    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*sin(u)*sin(v)");
            z    = ExpressionParser.Parse("(70^(1/2)/8*sin(u)^3*cos(3v)*1/pi^(1/2))^2*cos(u)");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("pi");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("2pi");
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        calcManager.PresetPressed();
    }
コード例 #7
0
    protected void HandleInput(string source)
    {
        List <string> x;
        List <string> y;
        List <string> z;
        List <string> umin = ExpressionParser.Parse("");
        List <string> umax = ExpressionParser.Parse("");
        List <string> tmin = ExpressionParser.Parse("");
        List <string> tmax = ExpressionParser.Parse("");
        List <string> vmin = ExpressionParser.Parse("");
        List <string> vmax = ExpressionParser.Parse("");
        List <string> wmin = ExpressionParser.Parse("");
        List <string> wmax = ExpressionParser.Parse("");

        ExpressionSet expressionSet = densManager.es;

        switch (source)
        {
        default:
            x    = ExpressionParser.Parse("0");
            y    = ExpressionParser.Parse("0");
            z    = ExpressionParser.Parse("0");
            umin = ExpressionParser.Parse("0");
            umax = ExpressionParser.Parse("0");
            vmin = ExpressionParser.Parse("0");
            vmax = ExpressionParser.Parse("0");
            print("unknown preset pressed");
            break;

        // Orbitals
        case "1S":
            x = ExpressionParser.Parse("(1.772454*e^(-1*(x^2+y^2+z^2)^(1/2)))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(3);
            densManager.setSleepInterval(126);
            break;

        case "2S":
            x = ExpressionParser.Parse("(0.099735*(2-(x^2+y^2+z^2)^(1/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/2))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(10);
            densManager.setSleepInterval(63);
            break;

        case "2Pz":
            x = ExpressionParser.Parse("(0.099735*z*e^(-1*((x^2+y^2+z^2)^(1/2))/2))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(12);
            densManager.setSleepInterval(63);
            break;

        case "3S":
            x = ExpressionParser.Parse("(0.004021*(27-18*(x^2+y^2+z^2)^(1/2)+2*(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(20);
            densManager.setSleepInterval(42);
            break;

        case "3Pz":
            x = ExpressionParser.Parse("(0.004925*(6-(x^2+y^2+z^2)^(1/2))*z*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(22);
            densManager.setSleepInterval(63);
            break;

        case "3Dz\x00B2":
            goto case "3Dz2";

        case "3Dz2":
            x = ExpressionParser.Parse("(0.002844*(3*z^2-(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(24);
            densManager.setSleepInterval(63);
            break;

        case "3Dxy":
            x = ExpressionParser.Parse("(0.009850*x*y*e^(-1*((x^2+y^2+z^2)^(1/2))/3))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(24);
            densManager.setSleepInterval(63);
            break;

        case "4S":
            x = ExpressionParser.Parse("(0.006965*(1-0.75*(x^2+y^2+z^2)^(1/2)+0.125*(x^2+y^2+z^2)-0.005208*(x^2+y^2+z^2)^(3/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(30);
            densManager.setSleepInterval(42);
            break;

        case "4Pz":
            x = ExpressionParser.Parse("(0.039424*(1-0.25*(x^2+y^2+z^2)^(1/2)+0.0125*(x^2+y^2+z^2))*z*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(34);
            densManager.setSleepInterval(42);
            break;

        case "4Dz\x00B2":
            goto case "4Dz2";

        case "4Dz2":
            x = ExpressionParser.Parse("(0.002204*(3*z^2-0.25*z^2*(x^2+y^2+z^2)^(1/2)-(x^2+y^2+z^2)+0.083333*(x^2+y^2+z^2)^(3/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(21);
            break;

        case "4Dxy":
            x = ExpressionParser.Parse("(0.003817*x*y*(1-0.083333*(x^2+y^2+z^2)^(1/2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(42);
            break;

        case "4Fz\x00B3":
            goto case "4Fz3";

        case "4Fz3":
            x = ExpressionParser.Parse("(0.000082*z*(5*z^2-3*(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;

        case "4Fxz\x00B2":
            goto case "4Fxz2";

        case "4Fxz2":
            x = ExpressionParser.Parse("(0.000101*x*(5*z^2-(x^2+y^2+z^2))*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;

        case "4Fxyz":
            x = ExpressionParser.Parse("(0.000636*x*y*z*e^(-1*((x^2+y^2+z^2)^(1/2))/4))^2");
            y = ExpressionParser.Parse("0");
            z = ExpressionParser.Parse("0");
            densManager.setRange(40);
            densManager.setSleepInterval(63);
            break;
        }

        expressionSet.AddExpression("X", x);
        expressionSet.AddExpression("Y", y);
        expressionSet.AddExpression("Z", z);
        expressionSet.AddRange("t", tmin, tmax);
        expressionSet.AddRange("u", umin, umax);
        expressionSet.AddRange("v", vmin, vmax);
        expressionSet.AddRange("w", wmin, wmax);
        densManager.PresetPressed();
    }