# 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 ??

1/24/2019 11:34:34 AM

Soorya Narayanan9 Answers

New AnswerFirst calculate the height of the triangle. You get a right triangle. Use the formulas of angle in a right triangle.

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.

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 ??

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.

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...