Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to get the angle? (Read 1803 times)
Hamdy Ghanem
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 110
Location: Egypt
Joined: Mar 11th, 2009
How to get the angle?
Nov 12th, 2011 at 2:34pm
Print Post  
How to get the angle of a link

assume a straight  link and I want to get the angle of think with the horizontal ,how?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to get the angle?
Reply #1 - Nov 14th, 2011 at 7:15am
Print Post  
This should give you the angle in degrees:

Code
Select All
double dx = point2.X - point1.X;
double dy = point2.Y - point1.Y;
double a = Math.Atan(-dy / dx) * 180 / Math.PI;
if (dx < 0)
	a += 180; 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint