0

Angle calculation

I m having three atoms (a,b,c) with 9 coordinates in which I calculated the distance for a and c, b and c and got results in Armstrong Noww I want to find angle between a and b in degree How ??

24th Jan 2019, 11:34 AM
Soorya Narayanan
Soorya Narayanan - avatar
9 Respostas
+ 1
First calculate the height of the triangle. You get a right triangle. Use the formulas of angle in a right triangle.
24th Jan 2019, 12:01 PM
Théophile
Théophile - avatar
0
I don't understand the question. Can you show us the code or some of your progress?
24th Jan 2019, 12:23 PM
James
James - avatar
0
If you mean the angles in a triangle, when you have coordinates for each corner, you can use the angle between two lines formula (and gradient formulas). https://www.math-only-math.com/angle-between-two-straight-lines.html If the maths is difficult, ask me to explain. For me to help though, you really should share your code.
24th Jan 2019, 12:28 PM
James
James - avatar
0
x1=13.380 y1=17.835 z1=32.697 x2=14.166 y2=18.076 z2=33.485 x3=14.638 y3=19.021 z3=34.997 a=((x3-x1)**2+(y3-y1)**2+(z3-z1)**2)**0.5 b=((x3-x2)**2+(y3-y2)**2+(z3-z2)**2)**0.5 after this I want to calculate angle ??
24th Jan 2019, 1:23 PM
Soorya Narayanan
Soorya Narayanan - avatar
0
Try this website. You need to combine the second "Example" (red writing) and the "Angle between lines" (blue writing). http://www.nabla.hr/PC-LinePlaneIn3DSp2.htm The maths is clearly quite difficult. You might need to tweak some of the formulas to transfer them into code. I might try for you later if I have time.
24th Jan 2019, 10:56 PM
James
James - avatar
0
Or you could attempt recreate the triangle in 2D, then use the easier 2D formulas.
24th Jan 2019, 10:58 PM
James
James - avatar
0
In Python, for the angle at (x2, y2, z2)... import math a1 = x2 - x1 b1 = y2 - y1 c1 = z2 - z1 a2 = x3 - x2 b2 = y3 - y2 c2 = z3 - z2 radians = math.acos( (a1*a2 + b1*b2 + c1*c2) * (a1**2 + b1**2 + c1**2)**(-0.5) * (a2**2 + b2**2 + c2**2)**(-0.5) ) degrees = radians / math.pi * 180 Hopefully works...
24th Jan 2019, 11:17 PM
James
James - avatar
0
Need help for the other two angles?
24th Jan 2019, 11:25 PM
James
James - avatar