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 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 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 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; } } } }