Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anybody good with math?
#11
I just read rapidly the previous postings... As far I as have understood the request, this must work :

1) Declare in the main module
CONST Pi = 3.1415927#

2) Create this function
FUNCTION Arg (xa, ya)
'Returns the argument of a point in the (x,y) plan, in radians

IF xa > 0 THEN Arg = ATN(ya / xa)
IF xa < 0 THEN Arg = Pi - ATN(-ya / xa)
IF xa = 0 AND ya >= 0 THEN Arg = Pi / 2
IF xa = 0 AND ya <= 0 THEN Arg = -Pi / 2
END FUNCTION

3) Your angle is calculated as follows:

ya = y2-y1
xa = x2-x1
AngleRad = Pi/2 - Arg(xa,ya) ' Shift the origin and reverse to clockwise
AngleDeg = AngleRad/Pi*180 ' Converts raddians to degrees

Sorry if I'm out of scope... doing it quick !
hink Global, Make Symp' All ! ®
[Image: Banner.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)