Lengths and angles should be set with |abs| values (#93)
* Lengths and angles should be set with |abs| values * clean up
This commit is contained in:
@ -20,5 +20,6 @@ export function getLength(a: [number, number], b: [number, number]): number {
|
||||
export function getAngle(a: [number, number], b: [number, number]): number {
|
||||
const x = b[0] - a[0]
|
||||
const y = b[1] - a[1]
|
||||
return ((Math.atan2(y, x) * 180) / Math.PI + 360) % 360
|
||||
const result = ((Math.atan2(y, x) * 180) / Math.PI + 360) % 360
|
||||
return result > 180 ? result - 360 : result
|
||||
}
|
||||
|
Reference in New Issue
Block a user