Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a particle with a random position and velocity.
 /// The position is uniform in the unit box; the velocity in
 /// either direciton is chosen uniformly at random.
 /// </summary>
 public Particle(System.Random random)
 {
     _rx     = random.NextDoubleRange(0.0, 1.0);
     _ry     = random.NextDoubleRange(0.0f, 1.0f);
     _vx     = random.NextDoubleRange(-0.01f, 0.01f);
     _vy     = random.NextDoubleRange(-0.01f, 0.01f);
     _radius = random.NextDoubleRange(0.01f, 0.07f);
     _mass   = _radius * 10.0;
     _color  = Color.black;
 }