コード例 #1
0
 public double Distance(Vector a)
 {
     return (this - a).Length();
 }
コード例 #2
0
 public Vector RotateAround(Vector v, double ang)
 {
     this.Set(this - v);
     this.Rotate(ang);
     this.Set(this + v);
     return this;
 }
コード例 #3
0
 public Vector SetFromRotation(double r, double ang, Vector orgin)
 {
     return this.Set(this.SetFromRotation(r, ang) + orgin);
 }
コード例 #4
0
 public double AngleBetween(Vector a)
 {
     return (this.Angle() - a.Angle());
 }
コード例 #5
0
 public Vector Set(Vector a)
 {
     this.X = a.X;
     this.Y = a.Y;
     return this;
 }
コード例 #6
0
 private void drawPoint(Color color, Vector v, int size)
 {
     drawPoint(color, v.X, v.Y, size);
 }
コード例 #7
0
 private void drawPoint(Color color, Vector v)
 {
     drawPoint(color, v.X, v.Y);
 }
コード例 #8
0
        /* 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();
        }
コード例 #9
0
 /* 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);
 }