public double Distance(Vector a)
 {
     return (this - a).Length();
 }
 public Vector RotateAround(Vector v, double ang)
 {
     this.Set(this - v);
     this.Rotate(ang);
     this.Set(this + v);
     return this;
 }
 public Vector SetFromRotation(double r, double ang, Vector orgin)
 {
     return this.Set(this.SetFromRotation(r, ang) + orgin);
 }
 public double AngleBetween(Vector a)
 {
     return (this.Angle() - a.Angle());
 }
 public Vector Set(Vector a)
 {
     this.X = a.X;
     this.Y = a.Y;
     return this;
 }
 private void drawPoint(Color color, Vector v, int size)
 {
     drawPoint(color, v.X, v.Y, size);
 }
 private void drawPoint(Color color, Vector v)
 {
     drawPoint(color, v.X, v.Y);
 }
        /* Main events */
        private void ScreenSaverForm_Load(object sender, EventArgs e)
        {
            if (this.bounds != null && !previewMode)
                this.Bounds = bounds;

            Cursor.Hide();
            TopMost = true;

            this.g = this.CreateGraphics();
            this.rand = new Random();

            this.data = RegistryStorage.GetData();

            int idx = rand.Next(data.Count - 1);

            this.n = data[idx].N;
            this.factor = data[idx].F;

            this.verticles = new Vector[n];

            Vector orgin = new Vector(Width / 2, Height / 2);
            double radius = Math.Min(Width, Height) / 2 - 20;

            currentPoint = new Vector(rand.Next(Width), rand.Next(Height));

            for (int i = 0; i < n; i++)
            {
                verticles[i] = new Vector().SetFromRotation(radius, i*(2*Math.PI/n), orgin);
                Console.WriteLine("v " + i + ": " + verticles[i].ToString());
            }

            updateTimer.Tick += new System.EventHandler(this.timer1_Tick);
            updateTimer.Interval = 10;
            updateTimer.Start();
        }
 /* app functions */
 private void nextVerticle()
 {
     currentPoint += (verticles[rand.Next(this.n)] - currentPoint) * (1 - this.factor);
     drawPoint(Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255)), currentPoint);
 }