Prosg Active Member Licensed User Longtime User Mar 2, 2016 #1 Hello, i use this function php Deg2Rad but i need this in my b4a code ? is there a same function ? B4X: Dim lonMin, lonMax, latMin, latMax As Double lonMin = longitude - currentDistance/Abs(Cos(Deg2Rad (latitude))*111) regards
Hello, i use this function php Deg2Rad but i need this in my b4a code ? is there a same function ? B4X: Dim lonMin, lonMax, latMin, latMax As Double lonMin = longitude - currentDistance/Abs(Cos(Deg2Rad (latitude))*111) regards
JordiCP Expert Licensed User Longtime User Mar 2, 2016 #2 AFAIK, it does not exist as a core function But you can do your own function B4X: Sub Deg2Rad(myDeg As Double) As Double Return cPI*myDeg/180 End Sub --EDIT-- Or use cosD(..), which already takes the argument in degrees Upvote 0
AFAIK, it does not exist as a core function But you can do your own function B4X: Sub Deg2Rad(myDeg As Double) As Double Return cPI*myDeg/180 End Sub --EDIT-- Or use cosD(..), which already takes the argument in degrees
udg Expert Licensed User Longtime User Mar 2, 2016 #3 As far as I know, one degree is equal 0.01745329252 radians Upvote 0
eurojam Well-Known Member Licensed User Longtime User Mar 2, 2016 #4 you can write your own function: radians = degrees * (pi/180) degrees = radians * (180/pi) you have to think about, how precise you want have the value of pi (3.1415 or 3.14159265359...) or you can calculate it like Pi = 4 * ArcTan(1) Upvote 0
you can write your own function: radians = degrees * (pi/180) degrees = radians * (180/pi) you have to think about, how precise you want have the value of pi (3.1415 or 3.14159265359...) or you can calculate it like Pi = 4 * ArcTan(1)
eurojam Well-Known Member Licensed User Longtime User Mar 2, 2016 #5 JordiCP said: Return cPI*myDeg/180 Click to expand... always learning...didn't know that there is a pi constant in b4a...great!! Upvote 0
JordiCP said: Return cPI*myDeg/180 Click to expand... always learning...didn't know that there is a pi constant in b4a...great!!
JordiCP Expert Licensed User Longtime User Mar 2, 2016 #6 eurojam said: always learning...didn't know that there is a pi constant in b4a...great!! Click to expand... Don't miss it, I have just seen there is also a cE !! Great @Erel ! Upvote 0
eurojam said: always learning...didn't know that there is a pi constant in b4a...great!! Click to expand... Don't miss it, I have just seen there is also a cE !! Great @Erel !
Prosg Active Member Licensed User Longtime User Mar 3, 2016 #7 you mean i can do only : B4X: cosD(latitude) ? Upvote 0
JordiCP Expert Licensed User Longtime User Mar 3, 2016 #8 Just test it B4X: Log(cosD(latitude)) Log(cos(Deg2Rad(latitude))) Upvote 0