Ejemplo n.º 1
0
        public static void Create(E.Vector Pos, Models.Polygon Model, GphW3.CanvasPlotter Plotter)
        {
            Model.PolygonBlock.Clear();

            Model.StartsAt(new E.Vector(0, 0) + Pos);
            Model.LineTo(new E.Vector(100, 0) + Pos);
            Model.LineTo(new E.Vector(100, 100) + Pos);
            Model.LineTo(new E.Vector(0, 100) + Pos);
            Model.LineTo(new E.Vector(0, 0) + Pos);
            Model.LineTo(new E.Vector(100, 100) + Pos);

            Model.PolygonBlock.draw(Plotter);
        }
Ejemplo n.º 2
0
        public static void Create(double Vergrößerungsfaktor, Models.Polygon Model, GphW3.CanvasPlotter Plotter)
        {
            var v = new E.Vector(500, 400);

            Model.Clear();
            Model.StartsAt(v);

            Css.Color[] colors = { Css.Color.Green, Css.Color.Lime, Css.Color.Orange, Css.Color.Aqua };

            for (int phi = 0, ci = 0; phi < 360; phi += 4, ci++)
            {
                var vs    = new E.Vector(100, 0);
                var rot   = new E.Transformations.RotationInCylindricalCoordinates(2, phi * Math.PI / 180.0, 0, 1);
                var scale = new E.Transformations.Scale(Vergrößerungsfaktor * phi / 360.0, 1);

                var vrand = rot.apply(scale.apply(vs)) + v;

                Model.LineTo(vrand, colors[ci % colors.Length]);
            }

            Model.PolygonBlock.draw(Plotter);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Seiteninhalt programatisch aufbauen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Init(object sender, EventArgs e)
        {
            Model = mkoIt.Asp.PageState <Models.Polygon> .Create(Session);

            //var phld1 = sender as PlaceHolder;

            phld1.Controls.Add(
                new mkoIt.Asp.HtmlCtrl.DIV(
                    new Htm.Button("btnCreateSpiral", out btnCreateSpiral)
            {
                Text     = "Spirale erzeugen",
                SetClick = (s, args) =>
                {
                    double Vergrößerungsfaktor;
                    if (double.TryParse(tbx.Text, out Vergrößerungsfaktor))
                    {
                        SpiralFactory.Create(Vergrößerungsfaktor, Model, Plotter);
                    }
                }
            },
                    new Htm.TextBox("tbxSpiralFactor", out tbx)
            {
                Text        = "2",
                ToolTip     = "Vergrößerungsfaktor der Spirale",
                CssStyleBld = new Css.StyleBuilder()
                {
                    Width           = new Css.LengthPixel(30),
                    TextAlign       = Css.TextAlign.Right,
                    BackgroundColor = Css.Color.Aqua
                }
            },
                    new Htm.Button("btnCreateTrapez", out btnCreateTrapez)
            {
                Text     = "Trapez Erzeugen",
                SetClick = (s, args) =>
                {
                }
            },
                    new Htm.Button("btnCreateHausNiko", out btnCreateNikohome)
            {
                Text     = "Haus von Nikolaus",
                SetClick = (s, args) =>
                {
                    Model.Clear();
                    Css.Color[] colors = { Css.Color.Lime, Css.Color.Red, Css.Color.Blue };
                    int cs             = 0;
                    for (double a = 0.0; a < 2 * Math.PI; a += 2 * Math.PI / 20.0, cs++)
                    {
                        Model.DefaultColor = colors[cs % colors.Length];
                        var Pos            = new E.Vector(a * 200.0, Math.Sin(a) * 300);
                        NikoHomeFactory.Create(new E.Vector(100, 300) + Pos, Model, Plotter);
                    }
                }
            },

                    new Htm.BR(),
                    new Htm.Canvas("canMain", out canMain)
            {
                Width  = 1500,
                Height = 800
            }
                    )
            {
                CssStyleBld = new Css.StyleBuilder()
                {
                    BackgroundColor = Css.Color.Black,
                    BorderStyle     = Css.BorderStyle.Inset
                }
            }
                );

            Plotter = new mko.Graphic.WebClient.CanvasPlotter(new Htm.Canvas.ClientComponentScriptBld(canMain.ClientID));
        }