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.

How can I find all intersection points of the following circle and triangle?

Triangle

$$A:=\begin{pmatrix}22\\-1.5\\1 \end{pmatrix} B:=\begin{pmatrix}27\\-2.25\\4 \end{pmatrix} C:=\begin{pmatrix}25.2\\-2\\4.7 \end{pmatrix}$$

Circle

$$\frac{9}{16}=(x-25)^2 + (y+2)^2 + (z-3)^2$$

What I did so far was to determine the line equations of the triangle (a, b and c):

$a : \overrightarrow {OX} = \begin{pmatrix}27\\-2.25\\4 \end{pmatrix}+ \lambda_1*\begin{pmatrix}-1.8\\0.25\\0.7 \end{pmatrix} $

$b : \overrightarrow {OX} = \begin{pmatrix}22\\-1.5\\1 \end{pmatrix}+ \lambda_2*\begin{pmatrix}3.2\\-0.5\\3.7 \end{pmatrix} $

$c : \overrightarrow {OX} = \begin{pmatrix}22\\-1.5\\1 \end{pmatrix}+ \lambda_3*\begin{pmatrix}5\\-0.75\\3 \end{pmatrix} $

But I am not sure what I have to do next...

share|improve this question

3 Answers 3

up vote 1 down vote accepted

You want to find the intersection points of the lines and the cycle. You can to this by substituting. For instance: line $a$.

$$9 = (27-1.8\lambda_1 -25)^2 + (-2.25 + 0.25\lambda_1+2)^2 + (4+0.7\lambda_1)^2$$ Now you can calculate the value of $\lambda_1$, using the Quadratic formula.

You can ran into 3 cases: the discriminant is negative, in this case you have no intersection points, the discriminant is 0, there is one intersection point (note: the line is a tangent to the cycle in the found point), of discriminant positive, therefore 2 intersection points.

You get the coordinates of the points, by substituting $\lambda_1$ into the line equation $a$.

Now you have to check, if the points are indeed part of the triangle, or just part of the extension of the line. You can do this by making the creating the vectors $AB$ and $AP$. Look if they look both in the same direction and look, if $AB$ is longer than $AP$.

share|improve this answer
    
Thanks for the easy-to-follow solution. Two things: 1) I think you forgot to subtract -3 at the last term (4 + 0.7*l1 - 3). 2) After solving the equation I got a complex solution: 0.78180619644034278181-0.7593920177784496711i and 0.78180619644034278181+0.7593920177784496711i. Can I simply omit the irrational part? –  libjup Mar 9 '13 at 11:49
    
I just saw that I made a mistake in my post. It should be 9/16 and not 9 (9/16 gives me the complex solution...). –  libjup Mar 9 '13 at 11:50
    
You can't omit the irrational part. If you get a complex solutions for $\lambda_1$, there are no intersection points between the cycle and the line. –  user38034 Mar 9 '13 at 11:51
1  
I think your discussion is about "imaginary" parts (the things that include an "i"), not "irrational" parts. Imaginary and irrational are two completely different things. –  bubba Mar 9 '13 at 14:30
    
yes absolutely! ... probably had my brain switched off –  libjup Mar 9 '13 at 14:59

If $\,\;\;\vec a+t\vec b\,,\;t\in\Bbb R\;\;$ is a line in $\,\Bbb R^3\,$, then each of its points can be expressed as

$$\begin{pmatrix}\alpha_1:=a_1+tb_1\\\alpha_2:=a_2+tb_2\\\alpha_3:=a_3+tb_3\end{pmatrix}\;,\;\;a_i,b_i,t\in\Bbb R$$

then a point as above belongs to the circle

$$(x-25)^2+(y+2)^2+(z-3)^2=9\iff (\alpha_1-25)^2+(\alpha_2+2)^2+(\alpha_3-3)^2=9$$

so you have to substitute above, get a quadratic in $\,t\,$ and solve...of course, at most two different points for each straight line.

share|improve this answer
    
An intersection between the circle and a line doesn't necessarily give rise to an intersection between the circle and the triangle, though. –  bubba Mar 9 '13 at 12:50
    
Of course not, @bubba: one still has to check the intersection point is between two of the triangle's vertices...but that's already an easier task left for the OP. –  DonAntonio Mar 9 '13 at 13:51

The side $AB$ of the triangle has equation $P(t) = (1-t)A + tB$ for $0 \le t \le 1$. The $0 \le t \le 1$ part is important. If $t$ lies outside $[0,1]$, the point $P(t)$ will lie on the infinite line through $A$ and $B$, but not on the edge $AB$ of the triangle. Substitute $(1-t)A + tB$ into the circle equation, as others have suggested. This will give you a quadratic equation in $t$ that you can solve using the well-known formula.

But, a solution $t$ will give you a circle/triangle intersection point only if it lies in the range $0 \le t \le 1$. Solutions outside this interval can be ignored.

Do the same thing with sides $BC$ and $AC$.

share|improve this answer

Your Answer

 
discard

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.