Raised This Month: $ Target: $400
 0% 

Arctangent


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-08-2005 , 14:39   Arctangent
Reply With Quote #1

Would someone please explain the arctangent function to me, I'm confused. floatatan takes an angle and a radix. Isn't arctangent supposed to go from a number to an angle? And what is a radix? floatatan2 takes x, y and a radix. I'm still confused...

Thanks in advance.
__________________
twistedeuphoria is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 02-08-2005 , 16:01  
Reply With Quote #2

Well, I'm not really good at this stuff but have done some... things with it over the weeks.

Code:
        new Float:radians = floatatan(z/x, radian) // div by 0? :-P         new Float:degreeeeees = radians * g_ONEEIGHTYTHROUGHPI

floatatan returns radians. Which could be converted to degrees:
degrees = radians * 180 / pi

I think floatatan maybe can be set up to return degrees directly, although I think I had a problem with that for some reason.
Johnny got his gun is offline
TotalNoobScripter
Senior Member
Join Date: Aug 2004
Old 02-08-2005 , 18:37  
Reply With Quote #3

sry for this off-topic post, but for what purpose would u need arc's and tangets for? (Other than math class.)
TotalNoobScripter is offline
Send a message via AIM to TotalNoobScripter
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-08-2005 , 19:28  
Reply With Quote #4

Alright, I ended up using floatatan2 but I finally got it to work. I can get to polar coordinates with fairly good accuracy but I can't get back to rectangular nicely...

Code:
#include <amxmodx> #include <float> public plugin_init() {     register_plugin("Math Test","0.1","twistedeuphoria")     register_srvcmd("polar","to_polar")     register_srvcmd("rect","to_rectangular") } public to_polar() {     new xvalstr[3],yvalstr[3]     read_argv(1,xvalstr,2)     read_argv(2,yvalstr,2)     new Float:xval = floatstr(xvalstr)     new Float:yval = floatstr(yvalstr)     new Float:xsqr = floatpower(xval,2.0)     new Float:ysqr = floatpower(yval,2.0)     new Float:xysqtot = floatadd(xsqr,ysqr)     new Float:polarlen = floatsqroot(xysqtot)     new Float:polardeg = floatatan2(yval,xval,1)     server_print("LEN: %f DEG: %f",polarlen,polardeg)     return PLUGIN_HANDLED } public to_rectangular() {     new lenstr[21],degstr[21]     read_argv(1,lenstr,20)     read_argv(2,degstr,20)     new Float:len = floatstr(lenstr)     new Float:deg = floatstr(degstr)     new Float:xval = floatmul(len,floatcos(deg))     new Float:yval = floatmul(len,floatsin(deg))     server_print("X: %f Y: %f",xval,yval)     return PLUGIN_HANDLED }

This is what I have...any ideas as to the accuracy of the rectangular coordinates? Maybe variable accuracy? something else? I'll keep looking.
__________________
twistedeuphoria is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 02-09-2005 , 03:01  
Reply With Quote #5

I use floatatan as an integral part in these plugins: Sentry guns and Enemy spotted
Feels wonderful to get a real use of those. :-)
Johnny got his gun is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 02-09-2005 , 12:29  
Reply With Quote #6

You're no help! I suppose I'll just have to test how inaccurate it becomes in the real game <- LOL.
__________________
twistedeuphoria is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode