Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
I have a Spreadhset with the following representing two sides of a Triangle
Angle Length Side1, 20 35 Side2, 45 30 Side3, I need a formula to calculate the Angle (degrees) and Length for the third Angle TIA C |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
angle3 = 180 - ( angle1 + angle2 )
side3 is a bit trickier, must be a formula out there somewhere on the net though. Will have a think about that... "Cathy" wrote: I have a Spreadhset with the following representing two sides of a Triangle Angle Length Side1, 20 35 Side2, 45 30 Side3, I need a formula to calculate the Angle (degrees) and Length for the third Angle TIA C |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Your data doesn't describe a triangle.
Angle Length Side1 20 35 Side2 45 30 Side3 If you had: Angle Length Side1 20 35 Side2 30 Side3 Then the triangle would be: Angle Length Side1 20 35 Side2 17 30 Side3 143 61.65 ====== If you had: Angle Length Side1 20 35 Side2 45 Side3 Then the triangle would be: Angle Length Side1 20 35 Side2 45 72.36 Side3 115 92.75 Sometimes, too much information isn't a good thing! Cathy wrote: I have a Spreadhset with the following representing two sides of a Triangle Angle Length Side1, 20 35 Side2, 45 30 Side3, I need a formula to calculate the Angle (degrees) and Length for the third Angle TIA C -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Some more info:
Law of Cosines: http://en.wikipedia.org/wiki/Law_of_cosines Law of Sines: http://en.wikipedia.org/wiki/Law_of_sines and maybe Law of Tangents: http://en.wikipedia.org/wiki/Law_of_tangents merjet wrote: See he http://www.ajdesigner.com/phptriangl...ion_side_a.php Hth, Merjet -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
And sometimes too little information....
The angle provided is not the angle of a corner. It is the angle of the line (or direction the line is pointing in with 0 degrees being at horizontally pointing up, 90 degrees pointing vertically to the right etc.) Regards C |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
"Dave Peterson" wrote in message Your data doesn't describe a triangle. If you had: Angle Length Side1 20 35 Side2 30 Side3 Then the triangle would be: Angle Length Side1 20 35 Side2 17 30 Side3 143 61.65 That would contain the formula I would need, as I can calculate Angle by deducting Angle1 from Angle2 Would be much obliged if you could share the formula used to calculate the blanks in this example you showed. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Hi Cathy,
If this is a follow up to the post l helped you with earlier in the week then you need to change these 2 lines: TiltValue = Range("A1").Value / 6 Theta = (TiltValue / 60 ) * TwoPI to: TiltValue = Range("A1").Value Theta = (TiltValue * (PI/180)) or: TiltValue = Range("A1").Value / 6 Theta = Radians(TiltValue) If you look up COS and RADIANS in Excel help you will get explanations & examples. It saved me having to get out all those geometry books! Regards Michael |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Thanks again for that Michael
It is not quite a follow on from the previous mail but forms part of the same spreadsheet. The previous mail was to enable a visual illustration of what was happening. I did get your correction on changing the lines to show degrees and this works a treat. I thank you dearly for this. This part merely wants to calculate the values using formulaand display the values in cell. I will have to look at this over the weekend as I have to get out now before the weather turns. Have a nice day C "michael.beckinsale" wrote in message ... TiltValue = Range("A1").Value / 6 Theta = (TiltValue / 60 ) * TwoPI to: TiltValue = Range("A1").Value Theta = (TiltValue * (PI/180)) or: TiltValue = Range("A1").Value / 6 Theta = Radians(TiltValue) If you look up COS and RADIANS in Excel help you will get explanations & examples. It saved me having to get out all those geometry books! |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Sorry if I am confusing things by not explaining 100%
This is very usefull to me as my head is hurting going through Trig websites trying to remember everything again. Okay let me try again from scratch # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? Three lines form a triangle. Lets call it Triangle ABC with these letters on each of the corners (it is not a right Triangle) Line1 = a = AB Line2 = b = BC Line3 = c = CA Line1 starts at position 0.0 Line1 is angled at 20 degrees from 0 (0 being horizontal) Line1 is 35 meters long Line2 starts at position 0.0 also Line2 is angled at 45 degrees from 0 Line2 is 30 meters long The difference in angle between Line1 and Line2 is therefore 25 degrees Line3 completes the Triangle Need to calculate angle from 0 Need to calculate length Therefore using Daves Example the angle of side1 would be 25 If you had: # A B C 1 Angle Length 2 Side1 25 35 3 Side2 ? 30 4 Side3 ? ? And therefore I have to calculate three values If formulas for these three can be provided, then I will be very happy. Hope this makes a little more sense now. (Wish I could draw it as I see it in text) TIA C |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Line1 starts at position 0.0
Line2 starts at position 0.0 Need to calculate angle from 0 Sure sounds like Vectors: Length: 14.891395073096243 Angle (Depending on which direction): 141.6356275088955 or: -38.364372491104476 -- Dana DeLouis "Cathy" wrote in message ... Sorry if I am confusing things by not explaining 100% This is very usefull to me as my head is hurting going through Trig websites trying to remember everything again. Okay let me try again from scratch # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? Three lines form a triangle. Lets call it Triangle ABC with these letters on each of the corners (it is not a right Triangle) Line1 = a = AB Line2 = b = BC Line3 = c = CA Line1 starts at position 0.0 Line1 is angled at 20 degrees from 0 (0 being horizontal) Line1 is 35 meters long Line2 starts at position 0.0 also Line2 is angled at 45 degrees from 0 Line2 is 30 meters long The difference in angle between Line1 and Line2 is therefore 25 degrees Line3 completes the Triangle Need to calculate angle from 0 Need to calculate length Therefore using Daves Example the angle of side1 would be 25 If you had: # A B C 1 Angle Length 2 Side1 25 35 3 Side2 ? 30 4 Side3 ? ? And therefore I have to calculate three values If formulas for these three can be provided, then I will be very happy. Hope this makes a little more sense now. (Wish I could draw it as I see it in text) TIA C |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
OK I follow now.
The internal angle between lines a & b is 45-20=25. This angle is opposite c and is thus Angle-C Referring to the formula I posted previously c = SQRT(a^2 + b^2 - 2*a*b*COS((180-A-B)*PI()/180)) change (180-A-B) to 25 and include the known side lengths a & b = SQRT(35^2+30^2-2*35*30*COS(25*PI()/180)) = 14.8913950730962 Somehow Dana managed to obtain an extra 2dp of precision beyond the capabilities of my Excel <g Regards, Peter T "Cathy" wrote in message ... Sorry if I am confusing things by not explaining 100% This is very usefull to me as my head is hurting going through Trig websites trying to remember everything again. Okay let me try again from scratch # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? Three lines form a triangle. Lets call it Triangle ABC with these letters on each of the corners (it is not a right Triangle) Line1 = a = AB Line2 = b = BC Line3 = c = CA Line1 starts at position 0.0 Line1 is angled at 20 degrees from 0 (0 being horizontal) Line1 is 35 meters long Line2 starts at position 0.0 also Line2 is angled at 45 degrees from 0 Line2 is 30 meters long The difference in angle between Line1 and Line2 is therefore 25 degrees Line3 completes the Triangle Need to calculate angle from 0 Need to calculate length Therefore using Daves Example the angle of side1 would be 25 If you had: # A B C 1 Angle Length 2 Side1 25 35 3 Side2 ? 30 4 Side3 ? ? And therefore I have to calculate three values If formulas for these three can be provided, then I will be very happy. Hope this makes a little more sense now. (Wish I could draw it as I see it in text) TIA C |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
I forgot about the 'other' angle. First the formula to calculate an internal
angle from three known side lengths - A=ACOS((b^2+c^2-a^2)/(2*b*c))*180/PI() or as you want internal Angle-B B=ACOS((a^2+c^2-a^2)/(2*a*c))*180/PI() =ACOS((35^2+14.8913950730962^2-30^2)/(2*35*14.8913950730962))*180/PI() = 58.36437249 Deduct your original 20, elevation of lineA from the horizontal =38.3643724911045 or depending on direction = 141.635627508895 Regards, Peter T "Peter T" <peter_t@discussions wrote in message ... OK I follow now. The internal angle between lines a & b is 45-20=25. This angle is opposite c and is thus Angle-C Referring to the formula I posted previously c = SQRT(a^2 + b^2 - 2*a*b*COS((180-A-B)*PI()/180)) change (180-A-B) to 25 and include the known side lengths a & b = SQRT(35^2+30^2-2*35*30*COS(25*PI()/180)) = 14.8913950730962 Somehow Dana managed to obtain an extra 2dp of precision beyond the capabilities of my Excel <g Regards, Peter T "Cathy" wrote in message ... Sorry if I am confusing things by not explaining 100% This is very usefull to me as my head is hurting going through Trig websites trying to remember everything again. Okay let me try again from scratch # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? Three lines form a triangle. Lets call it Triangle ABC with these letters on each of the corners (it is not a right Triangle) Line1 = a = AB Line2 = b = BC Line3 = c = CA Line1 starts at position 0.0 Line1 is angled at 20 degrees from 0 (0 being horizontal) Line1 is 35 meters long Line2 starts at position 0.0 also Line2 is angled at 45 degrees from 0 Line2 is 30 meters long The difference in angle between Line1 and Line2 is therefore 25 degrees Line3 completes the Triangle Need to calculate angle from 0 Need to calculate length Therefore using Daves Example the angle of side1 would be 25 If you had: # A B C 1 Angle Length 2 Side1 25 35 3 Side2 ? 30 4 Side3 ? ? And therefore I have to calculate three values If formulas for these three can be provided, then I will be very happy. Hope this makes a little more sense now. (Wish I could draw it as I see it in text) TIA C |
#14
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
I thank you both for your all this
Your formula is perfect. I just had difficulty relating your references to A,a,B,b,C and c. Again I realise this is probably due to a mistake in my discription. All this trig stuff is all slowly coming back to me. What I should have said was Line1 = b = AC = 20° from 0° = 35 meters Line2 = c = AB = 45° from 0° = 30 meters Line3 = a = CB = ?° from 0° = ? Meters (I simply forgot that side "a" would be opposite to corner "A" :) Going by the above then A = BAC = 45° - 20° = 25° A=ACOS((b^2+c^2-a^2)/(2*b*c))*180/PI() I already have A. It is 25° or as you want internal Angle-B B=ACOS((a^2+c^2-a^2)/(2*a*c))*180/PI() ?Should this not read: B=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() Is the following therefore correct? A°=BAC=25° B°=ABC=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() = 96.63893451 C°=ACB=ACOS((b^2+a^2-c^2)/(2*a*b))*180/PI() = 58.36374786 And modelling by previous spreadsheet # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? The formula for B4 is: =180-(ACOS((C4^2+C2^2-C3^2)/(2*C4*C2))*180/PI())+B2 = 141.6362521° and Formula for C4 is: =ROUND(SQRT(C2^2+C3^2-2*C2*C3*COS((B3-B2)*PI()/180)),2) =14.89139507 meters I have just realised another mistake in my original example, i.e. the angle of c should have been in the opposite direction. I should be able to work that out myself and correct what I am trying to achieve. Thank you so much for all your help. Kind regards C |
#15
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
I have just realized another mistake in my original example, i.e. the
angle of c should have been in the opposite direction. I think you want to describe vector bc in both its Magnitude, and Direction. You have to keep track of both the internal angles, and a reference angle to make corrections to get the correct answer. I was just suggesting an alternate method to avoid keeping track of all that. Since this is in a programming group, I was just suggesting subtraction like this: v1 = Vector(35, 20) v2 = Vector(-30, 45) '...etc Don't forget an angle below the horizon is negative. =DEGREES(ATAN((3*SQRT(2)-7*SIN(RADIANS(20)))/(3*SQRT(2)-7*COS(RADIANS(20))))) -38.3643724911045 (Add 180 to get opposite "direction" of 141.635627508896) On technique I like to use is to define a Named Constant in Excel to help convert Degrees to Radians. For Example: Deg = Pi()/180 Hence, an alternative for Length might be: =5*SQRT(85 - 42*SQRT(2)*COS(20*Deg) - 42*SQRT(2)*SIN(20*Deg)) 14.8913950730962 Maybe something of interest http://en.wikipedia.org/wiki/Vector_%28spatial%29 -- HTH Dana DeLouis "Cathy" wrote in message ... I thank you both for your all this Your formula is perfect. I just had difficulty relating your references to A,a,B,b,C and c. Again I realise this is probably due to a mistake in my discription. All this trig stuff is all slowly coming back to me. What I should have said was Line1 = b = AC = 20° from 0° = 35 meters Line2 = c = AB = 45° from 0° = 30 meters Line3 = a = CB = ?° from 0° = ? Meters (I simply forgot that side "a" would be opposite to corner "A" :) Going by the above then A = BAC = 45° - 20° = 25° A=ACOS((b^2+c^2-a^2)/(2*b*c))*180/PI() I already have A. It is 25° or as you want internal Angle-B B=ACOS((a^2+c^2-a^2)/(2*a*c))*180/PI() ?Should this not read: B=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() Is the following therefore correct? A°=BAC=25° B°=ABC=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() = 96.63893451 C°=ACB=ACOS((b^2+a^2-c^2)/(2*a*b))*180/PI() = 58.36374786 And modelling by previous spreadsheet # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? The formula for B4 is: =180-(ACOS((C4^2+C2^2-C3^2)/(2*C4*C2))*180/PI())+B2 = 141.6362521° and Formula for C4 is: =ROUND(SQRT(C2^2+C3^2-2*C2*C3*COS((B3-B2)*PI()/180)),2) =14.89139507 meters I have just realised another mistake in my original example, i.e. the angle of c should have been in the opposite direction. I should be able to work that out myself and correct what I am trying to achieve. Thank you so much for all your help. Kind regards C |
#16
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
angle of c should have been in the opposite direction.
As a side note, you gave vectors a b (45 deg @ 30m) a c (20 deg @ 35m) You are asking for b c (sloping down to right) Hence: a b + b c = a c or b c = a c - a b That is why I suggested Subtraction. -- Dana DeLouis <snip |
#17
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
If interested, since this is a programming group:
Sub Demo() Dim x, y, Deg Deg = [PI()/180] 'Technique only, or use Radians() x = 35 * Cos(20 * Deg) - 30 * Cos(45 * Deg) y = 35 * Sin(20 * Deg) - 30 * Sin(45 * Deg) With WorksheetFunction Debug.Print " Side: " & Sqr(.SumX2PY2(x, y)) Debug.Print "Angle: " & .Degrees(.Atan2(x, y)) Debug.Print "Or:" Debug.Print "Angle: " & .Degrees(.Atan2(x, y)) + 180 End With End Sub Returns: Side: 14.8913950730962 Angle: -38.3643724911045 Or: Angle: 141.635627508896 -- HTH :) Dana DeLouis "Dana DeLouis" wrote in message ... angle of c should have been in the opposite direction. As a side note, you gave vectors a b (45 deg @ 30m) a c (20 deg @ 35m) You are asking for b c (sloping down to right) Hence: a b + b c = a c or b c = a c - a b That is why I suggested Subtraction. -- Dana DeLouis <snip |
#18
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Looks like you are well on the right track. I haven't looked closely at your
slightly modified formulas but all your results appear same as Dana's & mine, so I assume all OK. Regards, Peter T "Cathy" wrote in message ... I thank you both for your all this Your formula is perfect. I just had difficulty relating your references to A,a,B,b,C and c. Again I realise this is probably due to a mistake in my discription. All this trig stuff is all slowly coming back to me. What I should have said was Line1 = b = AC = 20° from 0° = 35 meters Line2 = c = AB = 45° from 0° = 30 meters Line3 = a = CB = ?° from 0° = ? Meters (I simply forgot that side "a" would be opposite to corner "A" :) Going by the above then A = BAC = 45° - 20° = 25° A=ACOS((b^2+c^2-a^2)/(2*b*c))*180/PI() I already have A. It is 25° or as you want internal Angle-B B=ACOS((a^2+c^2-a^2)/(2*a*c))*180/PI() ?Should this not read: B=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() Is the following therefore correct? A°=BAC=25° B°=ABC=ACOS((a^2+c^2-b^2)/(2*a*c))*180/PI() = 96.63893451 C°=ACB=ACOS((b^2+a^2-c^2)/(2*a*b))*180/PI() = 58.36374786 And modelling by previous spreadsheet # A B C 1 Side Direction Length 2 Line1 20 35 3 Line2 45 30 4 Line3 ? ? The formula for B4 is: =180-(ACOS((C4^2+C2^2-C3^2)/(2*C4*C2))*180/PI())+B2 = 141.6362521° and Formula for C4 is: =ROUND(SQRT(C2^2+C3^2-2*C2*C3*COS((B3-B2)*PI()/180)),2) =14.89139507 meters I have just realised another mistake in my original example, i.e. the angle of c should have been in the opposite direction. I should be able to work that out myself and correct what I am trying to achieve. Thank you so much for all your help. Kind regards C |
#19
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Thanks for this Dana
At the moment I am just trying to get the math working, however there is still more I will have to do further down and then this Programming code you provided will be very usefull. Regards C |
#20
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
Hi Cathy
Sent you a mail last week but maybe it didn't get to you. I have a spreadsheet that calculates lengths and angles in triangles. Separate sheets for right angles triangles , problems using Cosine Rule, problems using Sine Rule and problems using dot product. Also contains various wrong answers students might get if they do the calculations wrongly. Send me an email if you would like a copy. regards Paul On Mar 2, 9:09*pm, "Cathy" wrote: Thanks for this Dana At the moment I am just trying to get the math working, however there is still more I will have to do further down and then this Programming code you provided will be very usefull. Regards C |
#21
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calculate Angle and Length in Triangle
I have done a spreadsheet to calculate if have you have 2 lengths and one
degree also to work out degrees of a triangle if you have the 3 lengths ALLAN I have a spreadhset with the following representing two sides of a Triangle Angle Length Side1, 20 35 Side2, 45 30 Side3, I need a formula to calculate the Angle (degrees) and Length for the third Angle TIA C |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trying to calculate average call length | Excel Worksheet Functions | |||
Function to calculate the Length of Service of an Employee | Excel Worksheet Functions | |||
Formula for Angle of triangle from opposite and adjacent lengths | Excel Worksheet Functions | |||
How do I calculate the angle between two lines on a chart | Charts and Charting in Excel | |||
formula help: calculate length of employment | Excel Worksheet Functions |