public Canvas Dibujar(ref Canvas Plano, bool Tranladar = false, bool Rotar = false, bool Escalar = false, int reflexion = 0)
        {
            //Crear Cuadrado
            Rectangle miCirculo = new Rectangle();

            miCirculo.Width  = this.lado;
            miCirculo.Height = this.lado;
            miCirculo.Fill   = color;

            //Crear canvas nuevo
            Frame miniCanvas = new Frame(Tranladar, Rotar, Escalar);

            miniCanvas.Width  = this.lado;
            miniCanvas.Height = this.lado;
            miniCanvas.Children.Add(miCirculo);
            Canvas.SetLeft(miCirculo, 0);
            Canvas.SetTop(miCirculo, 0);

            //Agregar miniCanvas al plano
            Plano.Children.Add(miniCanvas);
            Canvas.SetLeft(miniCanvas, Plano.Width / 2 - this.lado / 2 + this.Coor[0]);
            Canvas.SetTop(miniCanvas, Plano.Height / 2 - this.lado / 2 + this.Coor[1] * -1);
            //Reflexion
            Transformar.Reflexion(miniCanvas, ref Plano, reflexion, this.Coor[0], this.Coor[1] * -1);
            return(miniCanvas);
        }
Beispiel #2
0
        public Canvas Dibujar(ref Canvas Plano, bool Tranladar = false, bool Rotar = false, bool Escalar = false, int reflexion = 0)
        {
            //Crear Circulo
            Ellipse miElipse = new Ellipse();

            miElipse.Width  = a;
            miElipse.Height = b;
            miElipse.Fill   = color;

            //Crear canvas nuevo
            Frame miniCanvas = new Frame(Tranladar, Rotar, Escalar);

            miniCanvas.Width  = a;
            miniCanvas.Height = b;
            miniCanvas.Children.Add(miElipse);
            Canvas.SetLeft(miElipse, 0);
            Canvas.SetTop(miElipse, 0);

            //Agregar miniCanvas al plano
            Plano.Children.Add(miniCanvas);
            Canvas.SetLeft(miniCanvas, Plano.Width / 2 - (this.a / 2) + this.Coor[0]);
            Canvas.SetTop(miniCanvas, Plano.Height / 2 - (this.b / 2) + this.Coor[1] * -1);
            //Reflexion
            Transformar.Reflexion(miniCanvas, ref Plano, reflexion, this.Coor[0], this.Coor[1] * -1);
            return(miniCanvas);
        }
Beispiel #3
0
        public Canvas Dibujar(ref Canvas Plano, bool Tranladar = false, bool Rotar = false, bool Escalar = false, int reflexion = 0)
        {
            //Crear canvas nuevo
            Frame miniCanvas = new Frame(Tranladar, Rotar, Escalar);

            miniCanvas.Width  = this.radio * 2;
            miniCanvas.Height = this.radio * 2;

            CalcularPuntos(miniCanvas.Width / 2, miniCanvas.Height / 2);

            //Crear Poligono
            Polygon poligono = new Polygon();

            poligono.Stroke              = color;//esto es para el contorno
            poligono.Fill                = color;
            poligono.StrokeThickness     = 1;
            poligono.HorizontalAlignment = HorizontalAlignment.Left;
            poligono.VerticalAlignment   = VerticalAlignment.Center;
            poligono.Points              = puntos;

            //Agregar poligono al canvas
            miniCanvas.Children.Add(poligono);
            Canvas.SetLeft(poligono, 0);
            Canvas.SetTop(poligono, 0);


            //Agregar miniCanvas al plano
            Plano.Children.Add(miniCanvas);
            Canvas.SetLeft(miniCanvas, Plano.Width / 2 - this.radio + this.Coor[0]);
            Canvas.SetTop(miniCanvas, Plano.Height / 2 - this.radio + this.Coor[1] * -1);
            //Reflexion
            Transformar.Reflexion(miniCanvas, ref Plano, reflexion, this.Coor[0], this.Coor[1] * -1);
            return(miniCanvas);
        }
 private void Timer1_Tick(object sender, EventArgs e)
 {
     for (int i = 0; i < canvasCoor.Children.Count; i++)
     {
         if (canvasCoor.Children[i] is Frame)
         {
             Frame aux = (Frame)canvasCoor.Children[i];
             //Transformar.Reflexion(ref canvasCoor, ref canvas1,1);
             if (aux.Tranladar)
             {
                 Transformar.Traslacion(ref aux, canvasCoor.Width, canvasCoor.Height);
             }
             if (aux.Rotar)
             {
                 Transformar.Rotar(ref aux, 1);
             }
             if (aux.Escalar)
             {
                 Transformar.Escalar(ref aux, 0.01);
             }
             Transformar.Aplicar(ref aux);
         }
     }
 }