Find point in triangle

Ben

New member
Joined
May 8, 2009
Messages
3
Hello, I was hoping for some help with finding point D in triangle ABC knowing the coordinates of A, B, C and their distances from D.
I was going to use it for a game, so I can't use graphing either.
I have looked around, and found a few examples, but I'm in basic Algebra right now, and I don't know half (that being an overstatement) of the things the examples discuss. I was just hoping for a formula (or set of formulas) that would take in the points (as Cartesian coordinates) and distances, and output D's coordinates in Cartesian coordinates.

A little explaining of the math behind this (in terms I can understand :wink:) would also be very helpful (but not needed).
Also, as usual, if you have any questions, don't hesitate to ask ;)

Thanks!
Ben
 


There are different methods to do this.

One method involves writing a system of three equations with symbols for the coordinates of point D, followed by solving the system for these two constants.

I'm not sure if your application is a computer game, but, if you're programming this game, then perhaps the programming language has commands or built-in routines for solving the system for you.

We use the Distance Formula for setting up the three equations.

Here's an example.

Point A(-5, -4) with distance AD = sqrt(74)

Point B(7, 2) with distance BD = sqrt(50)

Point C(2, 10) with distance CD = sqrt(53)

Let the unknown coordinates of point D be (x, y).

Substituting the coordinates of points A and D into the Distance Formula, along with the known distance, gives the following equation.

sqrt[(x + 5)^2 + (y + 4)^2] = sqrt(74)

We can clean this up a bit by squaring both sides.

(x + 5)^2 + (y + 4)^2 = 74

Doing the same with points B and C gives the other two equations.

(x - 7)^2 + (y - 2)^2 = 50

(x - 2)^2 + (y - 10)^2 = 53

Solving this system gives x = 0 and y = 3.

Are you writing a computer program? If so, do you know whether or not the programming language has any routines for solving systems of equations?

The three equations in my example are each equations of circles in the xy-plane, and point D(0,3) is the location where they all intersect.

(x + 5)^2 + (y + 4)^2 = 74

This is the equation for a circle of radius sqrt(74), centered at point A.

(x - 7)^2 + (y - 2)^2 = 50

This is the equation for a circle of radius sqrt(50) centered at point B, etc.

Perhaps, there's a programming command for finding an intersection point.

If I were to solve this system by hand, I would start by expanding the three equations.

x^2 + 10x + y^2 + 8y = 33

x^2 - 14x + y^2 - 4y = 64

x^2 - 4x + y^2 - 20y = -51

Subtracting the second equation from the first yields a linear equation.

24x + 12y = 36

Subtracting the third equation from the first yields a second linear equation.

14x + 28y = 84

The system of three quadratic equations is now reduced to a system of two linear equations.

Solving the first linear equation for y gives the following.

y = -2x + 3

Substituting this expression for y into the second linear equation gives the following.

-42x = 0

So we find that x = 0.

Substituting 0 for x into the expression for y above gives y = 3.

There is information on the Internet about something called Barycentric coordinates. Using vector calculus, these coordinates reduce the problem of finding the location of point D to finding the inverse of a simple matrix. So, I'm sure there's a formula that comes out of that process, but the reading turned out to be too heavy for me to understand by skimming over the information.

 
Sadly, no, there are no sub routines in the simple (ish) language I'm using..
Thank you very much for the brief, but complete overview though! It was a major help!
 


Perhaps, somebody else will post a succint formula in terms of the known coordinates and distances.

(I edited my first post to include some information about solving the system by hand.)

 
Would there be a way to solve the circle equation for x, then substitute in point A's coordinates??
 


What circle are you asking about?

In my example, the equation for the circle that passes through point D and whose center is located at point A is:

(x + 5)^2 + (y + 4)^2 = 74

This equation already contains the coordinates of point A.

If we solve it for x, then we get the following two expressions for x.

x = -5 + sqrt(58 - 8y - y^2)

x = -5 - sqrt(58 - 8y - y^2)

Here's the form of the equation for a circle of radius R centered at point (h, k).

(x - h)^2 + (y - k)^2 = R^2

If you tell me what strategy you're mulling over, then I might be able to make suggestions. I'm not really sure what your last question is about.

 
Re:

mmm4444bot said:

Perhaps, somebody else will post a succint formula in terms of the known coordinates and distances.
As you're saying Mark, it's easy but cumbersome...
9 variables (6 from coordinates, 3 from distances) :shock:
If Ben can't program this after the info you supplied, well...
I'm sure not interested in giving my typing finger a long workout!!!
 
Well, had an hour to kill...
AD=a, BD=b, CD=c ; coordinates: A(d,e), B(f,g), C(h,i), D(x,y)

Given: a,b,c,d,e,f,g,h,i : find x,y

w = d^2 + e^2 - a^2
u = b^2 - f^2 - g^2 + w
v = c^2 - h^2 - i^2 + w
p = i - e
q = e - g
r = f - d
s = d - h

x = (pu + qv) / [2(qs - pr)]
y = (u + 2rx) / (2q)

You impressed, Mark? :p
 


Seriously, yes; I'm impressed. Very succint!

I just verified that your result generates the correct coordinates for my example.

This is the sort of formula that I thought I could come up with from the inverse matrix equation (a la barycentric coordinates, or whatever they're called), if only I could remember my linear algebra.

I've archived this one. 8-)

 
So will you join my Fan Club?
Badly in need of members; only 1 now, my brother-in-law who owes me $500 !!
 
Denis said:
So will you join my Fan Club?
Badly in need of members; only 1 now, my brother-in-law who owes me $500 !!


If he cannot afford to pay the dues, then I'm sure that I cannot, either. :wink:

 
Top