• Create Account

Banner advertising on our site currently available from just \$5!

# hanstt

Member Since 08 Aug 2001
Offline Last Active Oct 15 2013 02:55 PM

### #5090765Stupid noob questions regarding radius...

Posted by on 01 September 2013 - 06:47 AM

If I understand your problem correctly:

You want to generate a random point (x,y) for a player that owns the chunk of circle between 0deg-15deg and your circle radius is 1 unit...

Randomly generate a vector as a length of 0-1 and an angle between 0-15deg.

The end point of that vector will be

x = L * cos(angle)

y = L * sin(angle)

You need to watch the convention of the sin/cos function you are using with regards to degrees vs radians.

Note that this will create a higher density of points close to the center of the disc. If you'd prefer a uniform distribution of points in the xy-plane, either generate (x, y)-pairs until one point falls within the circular sector of the player of interest, or scale the points by sqrt(L):

```x = sqrt(L) * cos(angle);
y = sqrt(L) * sin(angle);
```