Example #1
0
 public ChargeSetSet(int herdCount, int chargeCount, double magnitudeFactor, Scene scene)
 {
     setset = new HashSet <ChargeSet>();
     for (int i = 0; i < chargeCount; i++)
     {
         ChargeSet temp = new ChargeSet();
         temp.AdjustCount(chargeCount, scene);
         temp.Mutate(magnitudeFactor, 0, 0, scene);
         setset.Add(temp);
     }
 }
Example #2
0
        public void Frame()
        {
            _ctx = _canvas.CreateCanvas2d();
            Console.WriteLine("Canvas happening");

            if (first)
            {
                scene = new Scene(0, 500, 0, 500, new V(250, 250), new V(250, 0), 1, new Random());
                Console.WriteLine("Made the scene");

                charges = new ChargeSet();
                charges.AdjustCount(10, scene);
                charges.Mutate(1000000, 0, 0, scene);
                Console.WriteLine("Adjusted Count");

                particle = new Particle(scene.start);
                first    = false;
            }

            particle.PassTime(.1, charges);
            _ctx.FillStyle = "red";
            _ctx.FillRect(particle.location.x, particle.location.y, 5, 5);
            Console.WriteLine("Location: " + particle.location.x + " " + particle.location.y);

            foreach (Charge charge in charges.set)
            {
                Console.WriteLine("Draw Charge");
                _ctx.FillStyle = "gray";
                _ctx.FillRect(charge.location.x, charge.location.y, 5, 5);
            }

            if (scene.InBounds(particle.location))
            {
                Console.WriteLine("ping");
                Frame();
            }
        }