Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (bActive)
- {
- xDir += RND.Next(-ResX * Scale, ResY * Scale);
- yDir += RND.Next(-ResY * Scale, ResY * Scale);
- float distance = (float)Math.Sqrt(xDir * xDir + yDir * yDir);
- xDir = xDir / distance;
- yDir = yDir / distance;
- pX += xDir*Scale;
- pY += yDir*Scale;
- if (pX > ResX-1)
- pX = ResX-1;
- if (pY > ResY-1)
- pY = ResY-1;
- if (pY < 0)
- pY = ResY-1;
- if (pX < 0)
- pX = ResY-1;
- tBmp.SetPixel((int)(pX), (int)(pY), Color.Blue);
- Iterations++;
- if (Iterations >= MaxIterations)
- {
- bActive = false;
- pictureBox1.Image = tBmp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement