Draw a point at a given distance from the base point

I am trying to find a random point search algorithm at a given distance from a base point. For example:

alt text http://i34.tinypic.com/2e4vxao.png

It may just be basic math, and my brain isn’t working yet (forgive me, I haven’t brought coffee yet :)), but I tried to figure it out on paper and I won’t go anywhere.

+5
source share
3 answers

coordinate of a point on a circle with radius R and center (xc, yc):

x = xc + R*cos(a);
y = yc + R*sin(a);

changing the value of the angle a from 0 to 2 * PI, you can find any point on the circle.

+10
source

Use the angle from the vertical as your random input.

:

angle = rand(0,1)
x = cos(angle * 2 * pi) * Radius + x_centre
y = sin(angle * 2 * pi) * Radius + y_centre
+5

The main Pythagoras.

Choose a random number between 0 and 50 and specify h ^ 2 = a ^ 2 + b ^ 2 Add some random descriptions in the direction.

+1
source

All Articles