algorithmlanguage-agnosticmathpointgeometric-arc

Draw a point a set distance away from a base point


I'm trying to figure out an algorithm for finding a random point a set distance away from a base point. So for example:

alt text

This could just be basic maths and my brain not working yet (forgive me, haven't had my coffee yet :) ), but I've been trying to work this out on paper and I'm not getting anywhere.


Solution

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

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

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