Suppose, (x1, y1)
is a point on the perimeter of a circle (x-420)^2 (y-540)^2 = 260^2
what are the two points on the circle perimeter of distance d
(euclidean) from the point (x1, y1)
CodePudding user response:
Using trig
Assuming you are using a programming language. The answer is using pseudo code.
Using radians the distance d
along a circle can be expressed as an angle a
computed as a = d / r
(where r
is the radius)
Given an arbitrary point on the circle. (x1-420)^2 (y1-540)^2 = 260^2
(NOTE assumes x1, y1 are known) we can extract the center is x = 420
, y = 540
, and radius r = 260
The angular distance d is then a = d / 260
.
Most languages have the function atan2 which will compute the angle of a vector, We can get the angle from the circle center to the arbitrary point as ang = atan2(y1 - 540, x1 - 420)
(Note y
first then x
)
Thus the absolute angles from the arbitrary point {x1, y1}
to the points d
distance along the circle (ang1
, ang2
) is computed as...
// ? represents known unknowns
x = 420
y = 540
r = 260
d = ?
x1 = ?
y1 = ?
ang = atan2(y1 - y, x1 - x)
ang1 = ang d / r
ang2 = ang - d / r
And the coordinates of the points (px1
, py1
, px2
, py2
) computed as...
px1 = cos(ang1) * r x
py1 = sin(ang1) * r y
px2 = cos(ang2) * r x
py2 = sin(ang2) * r y
Vector algebra
The problem can also be solved using vector algebra and does not require the trig function atan2
Compute the unit vector representing the angle a = d / r
and then with the circle at the origin, transform (rotate) the point on the circle using the unit vector in both directions. Translate the points back to the circles original position for the solution.