11
$\begingroup$

Given an arbitrary arc, where you know the following values: end point (x1,y1), radius (r) and arc direction (e.g. clockwise or counterclockwise from start to end), how can I calculate the other endpoint of the arc (and I say endpoint because I think of an arc as line segment that is curved, which happens to lie on the circumference of the circle and it has two end points).

Though that's just how I interpret the problem and maybe I'm not thinking about it correctly.

EDIT: Yes, I know the Origin point and the length of the arc. Sorry I forgot to mention. Also, the that circle would be on a 2D Cartesian plain (x and y axis.) Sorry, my math terminology is lacking.

Also, I'm not trying to cheat on homework or anything. This is a legitimate problem for an SVG graph I'm trying to create using JavaScript and I've tried my best but I need help.

Thanks in advance.

$\endgroup$
2
  • $\begingroup$ What about the center (radius is not enough, but having the center and one endpoint you can calculate $r$)? $\endgroup$
    – dtldarek
    Jan 10, 2013 at 15:38
  • $\begingroup$ Without knowing something like the length of the arc or the angle which it passes through, you can't determine the endpoint of some arc. For example, the unit circle from the point $(1,0)$. Then $(0,1)$ and $(-1,0)$ can both be considered the same direction, they are on the same radius, but the endpoints are different... $\endgroup$
    – Clayton
    Jan 10, 2013 at 15:39

1 Answer 1

13
$\begingroup$

Welcome to Math.SE! Here is my sketch for the case of clockwise direction: initial point is $A$, the endpoint you want is $B$, and $C$ is the radius of the circle on which the arc lies. Clockwise

I will use polar angles: you can see the description in Wikipedia. The formulas for conversion from polar to Cartesian (on the same wiki article) will also be used.

On the picture, $\theta$ is the polar angle of the direction in which the curve departs from point $A$. Since any radius of a circle is perpendicular to the circle, the polar angle of the vector $\vec{CA}$ is $\theta+\pi/2$. The length of $\vec{CA}$ is $r$. Therefore, its Cartesian coordinates are $$\vec {CA} = ( r\cos(\theta+\pi/2), r\sin(\theta+\pi/2)) = ( -r\sin(\theta), r\cos(\theta)) $$ Next, we need the coordinates of the vector $\vec{CB}$. Its length is also $r$. Since $\angle ACB$ is $L/r$ radian, the polar angle of $\vec{CB}$ is $\theta+\pi/2-L/r$. Convert to Cartesian: $$\vec {CB} = ( r\cos(\theta+\pi/2-L/r), r\sin(\theta+\pi/2-L/r)) = ( -r\sin(\theta-L/r), r\cos(\theta-L/r)) $$ Finally, $\vec{AB}=\vec{CB}-\vec{CA}$, which yields $$\boxed{\vec {AB} = ( -r\sin(\theta-L/r)+r\sin(\theta), r\cos(\theta-L/r)-r\cos(\theta)) } $$

These can be rewritten using some trigonometric identities, but I don't think it would win anything. As a sanity check, consider what happens when $L=0$: the vector is zero, hence $B$ is the same as $A$. As an aside, if $r\to \infty$ the curve becomes a straight line segment, but figuring out the limit is an exercise in calculus. :-)


If the curve bends counterclockwise, the signs will be different in a few places. Namely, the polar angle of $\vec{CA}$ will be $\theta-\pi/2$, hence $$\vec {CA} = ( r\sin(\theta), -r\cos(\theta)) $$ The polar angle of $\vec{CB}$ will be $\theta-\pi/2+L/r$, hence $$\vec {CB} = ( r\sin(\theta+L/r), -r\cos(\theta+L/r)) $$ The conclusion in this case is $$\boxed{\vec {AB} = ( r\sin(\theta+L/r)-r\sin(\theta), -r\cos(\theta+L/r)+r\cos(\theta))}$$


Later: a simpler solution for the case when $C$ is given. First, calculate the vector $\vec{CA}$ and convert it to polar coordinates using these formulas. Then either increase or decrease the angle by $L/r$, depending on counterclockwise/clockwise choice.

Since you wanted JavaScript, I made a jsfiddle and also copied the code below. The parameters are coordinates of A and C, as well as length of the arc and the direction. The radius $r$ is calculated within the function.

function findB(Ax, Ay, Cx, Cy, L, clockwise) {
    var r = Math.sqrt(Math.pow(Ax - Cx, 2) + Math.pow(Ay - Cy, 2));
    var angle = Math.atan2(Ay - Cy, Ax - Cx);
    if (clockwise) {
        angle = angle - L / r;
    }
    else {
        angle = angle + L / r;
    }
    var Bx = Cx + r * Math.cos(angle);
    var By = Cy + r * Math.sin(angle);
    return [Bx, By];
}
document.write(findB(0, 1, 1, 0, 1, true));
$\endgroup$
6
  • $\begingroup$ 5PM Thanks for your elaborate response. Sorry I didn't acknowledge it. I got sidetracked here. I have a question for you about the angle θ. I don't understand from your diagram where it belongs. $\endgroup$ Jan 23, 2013 at 21:26
  • $\begingroup$ Sorry, to elaborate: See, in my problem, I have the circle's origin point (C), its radius (r), a point along it's circumference (A), a length of an arc along the circumference (L), and A is one of its endpoints. Given all this info I need to find point B and the angle I DO know is <ACB. However, I'm not sure from your response if θ is this same angle. Do you think you could do a show me a sample probem being solved with your formulas? Also, is the angle in radians? I'm assuming yes since PI / 2 is being added to it in certain places. $\endgroup$ Jan 23, 2013 at 21:35
  • $\begingroup$ @RicardoCardoza Notice the part "$\angle ACB$ is $L/r$ radian" in my solution. Yes, I measure the angles in radians. // No, $\theta$ is the angle I introduced to indicate the direction in which the arc leaves the point $A$. If you already have $C$, then there is no need to introduce $\theta$. The solution becomes much simpler: I'll add it to the end of the answer. $\endgroup$
    – user53153
    Jan 24, 2013 at 1:32
  • $\begingroup$ 5PM: Thank you SO much your help. Your equations totally worked! Your math wizardry totally helped me with this crucial part. Can I send you a Starbucks card or something? I tried looking for a way to send you an email privately on math.stackexchange but I couldn't find it. Should I post my email so that you can email me? $\endgroup$ Jan 28, 2013 at 14:17
  • $\begingroup$ @RicardoCardoza Don't worry about it; you can send me 10 reputation points by clicking the "up" arrow next to my post, and we're even. :) $\endgroup$
    – user53153
    Jan 29, 2013 at 0:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .