Random _random = new Random();
private Vector3 RandomPointInCircle(Vector3 position, float radius)
{
float randomRadius = radius * (float)Math.Sqrt(_random.NextDouble());
double randomAngle = _random.NextDouble() * MathHelper.TwoPi;
float x = randomRadius * (float)Math.Cos(randomAngle);
float z = randomRadius * (float)Math.Sin(randomAngle);
return new Vector3(position.X + x, position.Y, position.Z + z);
}
I have experience working with C++ and DirectX. I prefer working with C# and WPF. In my spare time I work with HTML, JS, CSS.
Showing posts with label In Circle. Show all posts
Showing posts with label In Circle. Show all posts
Monday, May 10, 2010
XNA Random Point In Circle
The function creates a random point in a circle on the XZ plane.
Subscribe to:
Posts (Atom)