View Question
 Question
 Subject: Determing coordinate points of triangles Category: Science > Math Asked by: groves222-ga List Price: \$10.00 Posted: 27 May 2006 19:57 PDT Expires: 26 Jun 2006 19:57 PDT Question ID: 732965
 ```I need the steps involved to determine the 3 coordinate points (x,y) of a triangle as if it were plotted on a graph. For example, triangle ABC has the following given information: Point A is positioned at (1,1) Point B at (5,2) Angle BAC is 25 degrees Angle ACB is 90 degrees What is the coordinate of point C? Please see this diagram for a better illustration: http://www.swiftwx.com/triangle.gif *** Please provide detailed steps so i can reproduce this in a programming language. I am not a math major, i need specific steps here.```
 Subject: Re: Determing coordinate points of triangles Answered By: maniac-ga on 06 Jun 2006 18:43 PDT
 ```Hello Groves222, There are several good references explaining the concepts as well as source code that solves parts of the problems in different ways. Perhaps the simplest is to solve the equations in slope / intercept form. NOTE: you have to check for + / - infinity in the slope calculations and handle the results appropriately. I have a note at the end to address at least one work around for that condition. First, let's walk through the known information and start deriving some factors helpful in the calculation of the intercept. A is at (1,1) B is at (5,2) The line A-B can be represented in slope / intercept form as Y = M * X + B when computed as described at http://www-static.cc.gatech.edu/gvu/multimedia/nsfmmedia/graphics/elabor/math/mathfaq_lines.html where it starts by computing the slope (M) M = (By - Ay) / (Bx - Ax) = (2-1)/(5-1) = 0.25 and generates the intercept (B) by B = Ay - (Ax * M) = 1 - (1*0.25) = 0.75 or line A-B in slope / intercept form is Y = 0.25 * X + 0.75 The line A-C has a slope (M) of M = 0.25 + sin(25 degrees) = 0.672618262 and has intercept (B) of B = 1 - (1*0.672618262) - 0.327381738 or line A-C in slope / intercept form is Y = 0.672618262 * X + 0.327381738 The line B-C which is perpendicular to A-B has slope (M) of M[BC] = -(1 / M[AB]) = -(1/0.25) = -4 computing the intercept (B) as before, we get B = 2 - (5 * (-4)) = 22 or line B-C in slope / intercept form is Y = (-4) * X + 22 You can compute point C from this information using a formula Cx = (B[BC]-B[AC])/(M[BC]-M[AC]) Cx = (22 - 0.327381738) / (-4 - 0.672618262) Cx = 4.638217172 and Cy = M[AC]*Cx + B[AC] Cy = 0.672618262 * 4.638217172 + 0.327381738 Cy = 3.44713131 When you have a line with slope (M) of inifinity, there is no intercept (B) for that line. For example, when B-C is vertical, you can simply solve for point C using the known X using a simple adjustment to the intercept method. There is a similar fix needed if A-B is vertical. Additional explanations of this type of solution is at http://id.mind.net/~zona/mmts/intersections/intersectionOfTwoLines1/intersectionOfTwoLines1.html and with some additional links and "source code" at http://www.pdas.com/lineint.htm or another explanation and source code at http://www.geog.ubc.ca/courses/klink/gis.notes/ncgia/u32.html#SEC32.3.5 There is also a nice graphical application at http://www.analyzemath.com/Slope/Slope.html where you can examine some of these relationships graphically (computes slope / intercept for one or two lines). Search phrases used to locate the answer included: compute slope intercept line calculate intersection two lines intersection two lines source code as well as similar phrases can be used to find additional information. Please make a clarification request if some part of the answer is unclear or incomplete. I would be glad to help you further. Good luck with your work. --Maniac``` Clarification of Answer by maniac-ga on 07 Jun 2006 16:35 PDT ```Hello Groves222, I need to make a correction to the answer as follows: The line A-C has a slope (M) of M = TAN(25+ATAN(M[AB])) = TAN(39.03624347 degrees) = 0.810831944 and has intercept (B) of B = 1 - (1*0.810831944) - 0.189168056 or line A-C in slope / intercept form is Y = 0.810831944 * X + 0.189168056 This revised calculation properly captures the rotation of 25 degrees from A-B to A-C. As a result of this change, and using the corrected values the answer should now read You can compute point C from this information using a formula Cx = (B[BC]-B[AC])/(M[BC]-M[AC]) Cx = (22 - 0.189168056) / (-4 - 0.810831944) Cx = 4.533692342 and Cy = M[AC]*Cx + B[AC] Cy = 0.810831944 * 4.533692342 + 0.189168056 Cy = 3.865230633 I am not quite sure the minor differences in the answer I am providing and from the comments. Make a clarification request if you want a copy of the spreadsheet I used to calculate the results and perform some cross checks to make sure the results are OK. --Maniac```
 Subject: Re: Determing coordinate points of triangles From: frde-ga on 28 May 2006 10:29 PDT
 ```Your diagram is wrong - A and B are known - you have put C where B is You can calculate the length of A-B it is Sqrt( 1 + 16 ) ( from a triangle A-D-B with D at (5,1) Using Cos and Sin you can get the lengths of the other two sides You then need to get the angle BAD add it to CAB From that you have another triangle A-C-E where E is below C and level with A This is a bit complicated to explain without diagrams```
 Subject: Re: Determing coordinate points of triangles From: groves222-ga on 28 May 2006 12:42 PDT
 ```Ok, i updated the diagram. Can you please walk through the steps with the example above?```
 Subject: Re: Determing coordinate points of triangles From: ansel001-ga on 29 May 2006 02:26 PDT
 ```You still need to fix your diagram. Angle C should be 90º. You made angle B the right angle instead.```
 Subject: Re: Determing coordinate points of triangles From: klbr-ga on 29 May 2006 12:43 PDT
 ```Question is not clear. Is Angle ACB is 90 degrees? (like mentioned in the question) or Is Angle ABC is 90 degrees? (like mentioned in the diagram)```
 Subject: Re: Determing coordinate points of triangles From: dgfinck-ga on 02 Jun 2006 21:16 PDT
 ```Is the poster still interested? Is it desired generate a process to solve it in general for any locations of the points A & B, and any angle BAC? Or just this specific case? Will the 90deg angle remain right? Or is a solution desired for an arbitrary (2nd) angle? df```
 Subject: Re: Determing coordinate points of triangles From: berkeleychocolate-ga on 05 Jun 2006 18:21 PDT
 ```Here's a fairly neat way to solve this problem: Equate points of the plane with complex numbers. So (x,y) = x + y i. Say C = (x,y). Let r be the distance from A to C. Then since ABC is a right triangle with hypotenuse sqrt(17), r = sqrt(17)*cos25. So the vector from A to C can be obtained by rotating the unit vector in the direction from A to B by 25 degrees and multiplying it by r. That is, C = A + this vector = (1+i) + r*(cos25+isin25)*(4+i)/sqrt(17) = (1+i) + cos(25)*(cos25 + isin25)*(4+i) = (1+i) + cos25 * ( (4cos25 - sin25) + i*(cos25+4sin25) ). So x = 1 + cos25 * (4cos25 - sin25) and y = 1 + cos25 * (cos25 + sin 25).```
 Subject: Re: Determing coordinate points of triangles From: brix24-ga on 07 Jun 2006 02:53 PDT
 ```I get values for the x and y coordinates of point C that differ from both maniac-ga?s and berkeleychocolate-ga?s. The values I get are: x(c) y(c) 3.90255299781359 3.35348269108123 and 4.66859744093257 0.289304918605314 Both of these points seem to satisfy the condition of a right triangle with AB as the hypotenuse, that is, [x(c)-x(a)]^2 + [y(c)-y)a)]^2 + [x(c)-x(b)]^2 + [y(c)-y(b)]^2 = 17 In confirmation of the above x and y values, I get 17 when I post either of the following into Excel (perhaps Google spreadsheets soon?): =(3.90255299781359-1)^2 + (3.35348269108123-1)^2 + (3.90255299781359-5)^2 + (3.35348269108123-2)^2 =(4.66859744093257-1)^2 + (0.289304918605314-1)^2 +(4.66859744093257-5)^2 + (0.289304918605314-2)^2 ---- Google search strategies: slope perpendicular lines triangle coordinates The first search was to affirm (and correct) what I remembered about perpendicular lines. The second search led to drawing the correct line to solve the problem with a diagram. ----- Initial formulas that I got: x(c)=x(a) + [x(b)-x(a)][cos alpha]^2 ? (tan alpha)[y(b)-y(a)](cos alpha)^2 y(c)=y(a) + [y(b)-y(a)][cos alpha]^2 + (tan alpha)[x(b)-x(a)] (cos alpha)^2 and x(c)=x(a) + [x(b)-x(a)][cos alpha]^2 + (tan alpha)[y(b)-y(a)](cos alpha)^2 y(c)=y(a) + [y(b)-y(a)][cos alpha]^2 - (tan alpha)[x(b)-x(a)] (cos alpha)^2 These reduce to: x(c)=x(a) + (cos alpha) * {[x(b)-x(a)]*[cos alpha] ? [y(b)-y(a)]*(sin alpha)} y(c)=y(a) + (cos alpha) * {[y(b)-y(a)]*[cos alpha] + [x(b)-x(a)]*(sin alpha)} and x(c)=x(a) + (cos alpha) * {[x(b)-x(a)]*[cos alpha] + [y(b)-y(a)]*(sin alpha)} y(c)=y(a) + (cos alpha) * {[y(b)-y(a)]*[cos alpha] - [x(b)-x(a)]*(sin alpha)} Note: I haven?t checked out the generality of these formulas, that is, whether the signs of the [x(b)-x(a)] and [y(b)-y(a)] terms take care of the left/right, above/below relationships of points A and B in the general case. -------- Difference from berkeleychocolate-ga?s results: I can explain the Y value difference I get if berkeleychocolate?s result is simply missing a ?4? before the final sine. Difference from maniac?s result: I?m not sure why we differ; I got lost at > The line A-C has a slope (M) of > M = 0.25 + sin(25 degrees).```
 Subject: Re: Determing coordinate points of triangles From: berkeleychocolate-ga on 07 Jun 2006 12:38 PDT
 ```Correction: x is as I gave it and y is 1 + cos25*(cos25+4sin25). This gives agreement with brix24. I just lost a factor of 4 in the last step. One could rotate by -25 degrees and get the other solution.```
 Subject: Re: Determing coordinate points of triangles From: brix24-ga on 15 Jun 2006 06:27 PDT
 ```groves22-ga, Maniac's revised results fit the triangle that you show in your figure (AB perpendicular to BC), ABC = 90 degrees. Berkeleychocolate's and my results are for the triangle given by the data (AC is perpendicular to BC; ACB = 90 degrees).```