Example #1
0
        private void T_Tick(object sender, EventArgs e)
        {
            //TODO make last locations faded
            grp.Clear(Color.White);
            if (b.Position.X + Math.Cos(angle) * 10 > bmp.Width)
            {
                angle = 180;
            }
            if (b.Position.X + Math.Cos(angle) * 10 < 0)
            {
                angle = 0;
            }
            b.Position = new Punct(b.Position + new Punct(Math.Cos(angle) * 10, 0));
            grp.DrawEllipse(Pens.Black, (float)b.X - 10, (float)b.Y - 10, 20, 20);


            Stack <Punct> auxSt  = new Stack <Punct>();
            Stack <Punct> thisSt = b.LastPositions;

            for (int i = b.CountPositions; i > 0 && 0 < thisSt.Count; i--)
            {
                Punct p = thisSt.Peek();
                auxSt.Push(thisSt.Pop());
                Pen pe = new Pen(Color.FromArgb(200, Color.Blue));
                grp.DrawArc(pe, (float)p.X - 10, (float)p.Y - 10, 20, 20, angle + 100 + (b.CountPositions - i) * 15, 170 - (b.CountPositions - i) * 30);
            }
            while (auxSt.Count > 0)
            {
                thisSt.Push(auxSt.Pop());
            }
            pictureBox1.Image = bmp;
        }
Example #2
0
 public Ball(double r, Punct p, Color c, double dirsens, double viteza)
 {
     this.raza    = r;
     this.poz     = p;
     this.col     = c;
     this.dirsens = dirsens;
     this.viteza  = viteza;
 }
Example #3
0
 public Ball(double r, Punct p, Color c, double dirsens, double viteza)
 {
     sumaAriilor   += r * r;
     this.raza      = r;
     this.poz       = p;
     this.col       = c;
     this.dirsens   = dirsens;
     this.viteza    = viteza;
     CountPositions = 5;//implicitly stores the last 5 positions
 }
Example #4
0
 public Punct(Punct p)
 {
     this.x = p.x;
     this.y = p.y;
 }
Example #5
0
 public Ball(double r, Punct p, Color c, double dirsens, double viteza, string type) : this(r, p, c, dirsens, viteza)
 {
     this.type = type;
 }
Example #6
0
 /// <summary>
 /// Creates a Trail based on an Arc and a Color
 /// </summary>
 public Trail(Punct p, int width, int height, int startAngle, int sweepAngele, Color c)
     : this((float)p.X, (float)p.Y, width, height, startAngle, sweepAngele, c)
 {
 }