I have a 3 coordinates (A, B, C) which form two connected line segments.
I want to calculate the angle of the line segment based upon a random point that can fall either side of the line segments.
For example, if the random point was D, I would want to calculate the green angle, or if the random point was E, I would want to calculate the red angle.
I don't mind what programming language the solution is written in, but Python or Javascript would be preferred.
Assuming that the points use cartesian coordinates (x,y)
. Given two points A & C, angle made with x-axis is given by tan-inverse of (slope)
theta_ac = Math.atan((ya-yc)/(xa-xc))
Similarly once theta_bc
is computed, the angle is given by theta_bc - theta_ac
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.