April 19, 2024, 01:43:58 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


atan2 math issue

Started by J B Wood (Zumwalt), August 12, 2006, 10:12:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

J B Wood (Zumwalt)

On my V3.src, I have

declare import, atan2(float y, float x),float;


Then I have a method of:

V3 :: TargetIT(VECTOR3 obj1, VECTOR3 obj2), float
{

// Get distance to target
VECTOR3 detTarget;
float dist,dir;
detTarget = distance(obj1,obj2);
dist = detTarget.x * detTarget.x + detTarget.y * detTarget.y + detTarget.z * detTarget.z;

// Offset our distance by the target radius at some point
// Get our maximum attack range at some point
// Get our minimum attack range at some point
// minimum is weapon specific

// note: inherit attack info from target info at some point

dir=atan2(detTarget.x,detTarget.z);
return dir;
}


I have it defined in my V3.inc
Now, when I run the program, debug gives me:


Call stack
Aurora3D! <missing symbols>
Aurora3D! <missing symbols>
Aurora3D! <missing symbols>
kernel32! RegisterWaitForInputIdle + 73

Integer Registers
EAX: 0x00000020, EBX: 0x42DC8172
ECX: 0x00000000, EDX: 0x00000020
EDI: 0x0012FD74, ESI: 0x41280010
ESP: 0x0012FD00, EBP: 0x0012FD28
EIP: 0x004032DB, EFL: 0x00000202
CS: 0x001B, SS: 0x0023
DS: 0x0023, ES: 0x0023
FS: 0x003B, GS: 0x0000

FP Registers
ST0: 1.5707963267948966
ST1: -1.#QNAN00000000000
ST2: -1.#IND000000000000
ST3: 1.0000000000000000
ST4: 0.0000000000000000
ST5: 0.0000000000000000
ST6: 0.0000000000000000
ST7: 0.0000000000000000



and it bombs out, atan2 is a memeber of math I thought.. correct me here if I have done something wrong, but i need to use it :(

Ionic Wind Support Team

atan2 is from the C runtime library.  There isn't one in the Aurora math library.  So your declare is wrong.

declare cdecl import, atan2(double y, double x),double;

Ionic Wind Support Team