public main_form()
        {
            InitializeComponent();
            ////
            timer.Interval = 1;
            ////
            screen = picbox.CreateGraphics();
            screen.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
            screen.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;
            screen.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
            rand = new Random();
            ro = 500;
            teta = 3.1415 / 4;
            phi = 3.1415 / 4;
            x = ro * Math.Sin(phi) * Math.Cos(teta);
            y = ro * Math.Sin(phi) * Math.Sin(teta);
            z = ro * Math.Cos(phi);
            quit =  change = false;
            right = left = false;
            up =  down = false;
            zoomu =  zoomb = false;
            /////////////////////////////
            M32Size = 20;
            M32 = new Star[M32Size];

            M32[0] = new Star();
            M32[0].setPosition(0, 0, 0, 0, 0, 0, 5000);
            for (i = 1; i < M32Size; i++)
            {
                double khi = 2*Math.PI * i / (M32Size-1);

                int xx = rand.Next() % 300 - 150;
                int yy = rand.Next() % 300 - 150;
                int zz = 0;// rand.Next() % 300 - 150;
                double Ro = Math.Pow(xx * xx + yy * yy + zz * zz, 0.5);
                double V = Math.Pow(Star.GERAVITY * 5000 / Ro, 0.5);
                double Vec = 1.1*Math.Pow(xx * xx + yy * yy, 0.5);
                double vx = -yy * V / Vec;
                double vy = xx * V / Vec;
                M32[i] = new Star();
                M32[i].setPosition(xx , yy, zz, vx, vy, 0, 200);
            }
            ////////////////////////////
            T = new Transformation(x, y, z);
        }
 public void Show(Star Star1,Graphics screen)
 {
     Brush brush;
     if (Star1.available())
     {
         int w, h,xx,yy;
         double x = Star1.X - xOfDist;
         double y = Star1.Y - yOfDist;
         double z = Star1.Z - zOfDist;
         if (xOfCamera * x + yOfCamera * y + zOfCamera * z < xOfCamera * xOfCamera + yOfCamera * yOfCamera + zOfCamera * zOfCamera)
         {
             double R = Math.Pow((x - xOfCamera) * (x - xOfCamera) + (y - yOfCamera) * (y - yOfCamera) + (z - zOfCamera) * (z - zOfCamera), 0.5);
             double M = 255 - (255 * R) / (R + 400);
             brush = new SolidBrush(Color.FromArgb((int)M, (int)M, (int)M));
             double X, Y;
             X = this.GetNewX(x, y, z);
             Y = this.GetNewY(x, y, z);
             h = w = (int)((Math.Pow(Star1.R, 2) / Math.Pow(R * R - Math.Pow(Star1.R, 3.0 / 2), 0.5)) * 200);///2/3
             xx = (int)(screen.VisibleClipBounds.Width/ 2 + X - w / 2);
             yy = (int)(screen.VisibleClipBounds.Height / 2 + Y - h / 2);
             screen.FillEllipse(brush, xx, yy, w, h);
         }
     }
 }
 public void Add(Star Item)
 {
     x=(x*mass+(Item.x)*(Item.mass))/(mass+Item.mass);
     y=(y*mass+(Item.y)*(Item.mass))/(mass+Item.mass);
     z=(z*mass+(Item.z)*(Item.mass))/(mass+Item.mass);
     vx=(vx*mass+(Item.vx)*(Item.mass))/(mass+Item.mass);
     vy=(vy*mass+(Item.vy)*(Item.mass))/(mass+Item.mass);
     vz=(vz*mass+(Item.vz)*(Item.mass))/(mass+Item.mass);
     mass+=Item.mass;
     Item.mass=0;
     Item.x=100;
     Item.y=100;
     Item.z=100;
     Item.vx=0;
     Item.vy=0;
     Item.vz=0;
     r=Math.Pow(mass,1/3.0);
 }
 public void impact(Star Item)
 {
     if(Item.available())
     {
         if(Item!=this)
         {
             double GM=GERAVITY*Item.mass;
             double DeltaX=Item.x - x;
             double DeltaY=Item.y - y;
             double DeltaZ=Item.z - z;
             double R3=Math.Pow(DeltaX*DeltaX+DeltaY*DeltaY+DeltaZ*DeltaZ,1.5);
             if(Math.Pow(R3,1.0/3)<MIN_R)
             {
                 if(mass>=Item.mass)
                    this.Add(Item);
             }
             else
             {
                 ax+=(GM*DeltaX)/R3;
                 ay+=(GM*DeltaY)/R3;
                 az+=(GM*DeltaZ)/R3;
             }
         }
     }
 }
 public bool compare(Star Item)
 {
     return true;
 }