# Angle between two lines

**URL:** <https://forum.kirupa.com/t/angle-between-two-lines/262562>\
**Category:** Uncategorized\
**Created:** [June 6, 2008, 9:51pm UTC](https://forum.kirupa.com/t/angle-between-two-lines/262562 "2008-06-06T21:51:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nebula\_228](https://avatars.discourse-cdn.com/v4/letter/n/e99b99/32.png) [@nebula\_228](https://forum.kirupa.com/u/nebula_228)\
**Post date:** [June 6, 2008, 9:51pm UTC](https://forum.kirupa.com/t/angle-between-two-lines/262562/1 "2008-06-06T21:51:25Z")

</div>

hi EveryOne,

Can anybody tell me how to find an angle between two lines in flash.

Thanks in advance  
Deepthi

---

<div class="post-metadata">

**Author:** ![Insane\_au](https://avatars.discourse-cdn.com/v4/letter/i/439d5e/32.png) [@Insane\_au](https://forum.kirupa.com/u/Insane_au)\
**Post date:** [June 7, 2008, 2:40pm UTC](https://forum.kirupa.com/t/angle-between-two-lines/262562/2 "2008-06-07T14:40:29Z")

</div>

1. work out the gradients:  
var gradient:Number = (y2 - y1) / (x2 - x1);  
where (x1,y1) are the starting coordinates and (x2,y2) the ending coordinates of the line

2. convert the gradient to an angle:  
var angle:Number = Math.atan(gradient);

3. minus one from the other, get the absolute value and convert from radians to degrees:  
var difference:Number = Math.abs(angle1-angle2)\*180/Math.PI; hope that helped.

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [June 8, 2008, 6:46am UTC](https://forum.kirupa.com/t/angle-between-two-lines/262562/3 "2008-06-08T06:46:35Z")

</div>

Hey Tuncays, that’s really cool.

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [June 9, 2008, 8:51am UTC](https://forum.kirupa.com/t/angle-between-two-lines/262562/4 "2008-06-09T08:51:33Z")

</div>

sweet++;

Thanks for sharing.
