# Thread: Angle between two points

1. ## Angle between two points

Hello, I want to get the angle between two coordinates (2 objects of TCoordinate class), There is already a function to get the distance and there is also some equation on the internet that get the bearing between the two points. I nned the exact angle not just NW or SE, I want it to be something like 35 degree or 330 degree. How can I get that?

2. ## Re: Angle between two points

This logic will make you clear as to how to find angle in degree or radians.

But you will have to convert it for symbian.

var x1=100, y1=50;//TCoordinate 1
var x2=250, y2=70;// TCoordinate 2
var X=x1-x2;
var Y=y2-y1;
var Z=Math.round(Math.sqrt(Math.pow(X,2)+Math.pow(Y,2)));//the distance - rounded - in pixels
var r=Math.atan2(Y,X);//angle in radians (Cartesian system)
var d=r*180/Math.PI//angle in degrees
d<0?d+=Math.PI*2:null;//correction for "negative" quadrants

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•