Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given the image below, A is the centre of the circle, B is a point on the circumference and AC and DB lie on parallel lines.

Knowing A, C, D and the radius of the circumference, I need to find the quickest way (in term of # of calculations) to find B.



The position of C can vary, AC can also be parallel to x or y axis. This is for a program I'm making, I need to handle also corner cases in terms of calculations where the slope can be infinity (computers don't work well with infinity). In this context I found that using trigonometric functions I can achieve better results, but in this particular case I've come to no good solutions.

share|improve this question
Why close? It strikes me as a reasonable question with hypotheses left out. I could be wrong, though. –  rschwieb Sep 14 '12 at 18:23
Is A at the center? Is C meant to be on the circle? If not, how is the circle characterized? –  copper.hat Sep 14 '12 at 18:25
As far as those who voted to close, if it's difficult to tell what's being asked, then ask for a clarification. –  Graphth Sep 14 '12 at 20:02
There seem to be some key words missing which suggest this is not the best question ever, such as "centre", "parallel" and "radius". –  Henry Sep 14 '12 at 22:05
How can the circle be determined then? –  copper.hat Sep 15 '12 at 8:05

4 Answers 4

up vote 2 down vote accepted

Sounds like you want a programming-oriented solution, rather than a mathematical one. So, let's assume that you have (or can write) two standard functions:

Dot(u,v) -- computes the dot product of two 2D vectors $u$ and $v$

QuadraticRoots(a,b,c) -- computes the roots of the quadratic equation $ax^2+bx+c=0$

Then, following Christian Blattner's answer, we first calculate a vector $U = C-A$. We want to find $t$ such that $D+tU$ lies on the circle. But this means that $\lVert D+tU-A\rVert = r$, or $(D+tU-A)\cdot(D+tU-A) = r^2$.

Multiplying out the dot product, this means that:

$$(U\cdot U)t^2 + 2U\cdot(D-A)t + (D-A)\cdot(D-A) = r^2$$

This is a quadratic equation that you can solve for $t$. The pseudocode is:

U = C - A
V = D - A
a = Dot(U,U)
b = 2*Dot(U,V)
c = Dot(V,V) - r*r
(t1,t2) = QuadraticRoots(a,b,c)
If t1 > 0, then t = t1, else t = t2
B = D + t*U

If $A$ and $D$ are fixed, and only $B$ is varying, then you should precompute $V$ and $c$, of course, to save time.

share|improve this answer

Let $A:={\bf 0}$, $C:={\bf c}$, $D:={\bf d}$, and $B:={\bf b}$. Then you want ${\bf b}={\bf d}+\lambda{\bf c}$ for some $\lambda>0$ and $|{\bf b}|^2=r^2$, where the radius $r>0$ is assumed to be given. Therefore $$|{\bf d}|^2 + 2\lambda\langle{\bf d},{\bf c}\rangle +\lambda^2|{\bf c}|^2=r^2\ ,$$ which can be solved for $\lambda$ from the given data. Then ${\bf b}={\bf d}+\lambda{\bf c}$.

share|improve this answer

You can't (unless you are assuming these lines are parallel, which I will assume because your diagram suggests it.)

Compute the slope of the line through $A$ and $C$.

Use variables for the coordinates of $B$ and fill out the formula for the slope of the line through $B$ and $D$, using the fact that it's the same slope as the parallel line.

Rereading it again, I should also clarify that I'm assuming $A$ is the center, and you need to know what the radius of the circle is. Otherwise the picture is too vague.

share|improve this answer

Assuming that $A$ is the center of the circle, that $\overline{AC}$ and $\overline{BD}$ are parallel, and that you know the radius of the circle ($r$), and that $\overline{AC}$ and $\overline{BD}$ are parallel (If you don't know the center or the radius of the circle, you have no way of confirming that $B$ is on its circumference, and we can't tell anything about $\overline{BD}$ otherwise):

Compute the slope of the line through $\overline{AC}$ ($m$).

Use point-slope form of a line to define a line for $\overline{BD}$: $ y - y_D = m ( x - x_D )$

From here, you need to find a point on $\overline{BD}$ with distance $r$ from $A$.

You have the equation of a circle: $ r^2 = \sqrt{ (x - x_A)^2 + (y - y_A)^2 }$

Multiply the equation for the circle and isolate $y^2$ on one side. Isolate $y$ in the equation for the line, and then square that, so you have $y^2$ on one side by itself. That done, you can equate the two equations together, and then isolate y to form a quadratic equation.

You'll get two answers for the x-coordinate, so you'll need to do a sanity check to make sure you use the right one. (The other one will be the intersection of $\overline{BD}$ and the circle on the other side of $D$ from $B$.) Plug it into your line equation and you'll get the other part of your coordinate.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.