×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    81

    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?
    Thanks in advance

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Posts
    1,009

    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
    Regards,
    Shafali

Similar Threads

  1. Check on the Access Points
    By mallikachand in forum Symbian Networking & Messaging (Closed)
    Replies: 8
    Last Post: 2011-08-24, 08:23
  2. How to delete access points?
    By NRK in forum Symbian
    Replies: 4
    Last Post: 2009-09-11, 08:39
  3. Error when attempting to use multiple access points simultaneously
    By tkarh in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2009-06-11, 13:25
  4. Floating point numbers / Angle between points
    By Pandaemonium in forum Mobile Java General
    Replies: 8
    Last Post: 2004-03-10, 16:02

Posting Permissions

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