View previous topic :: View next topic |
Author |
Message |
yui0900826 Cheater
Reputation: 0
Joined: 09 Aug 2011 Posts: 35 Location: HongKong
|
Posted: Mon Sep 03, 2012 5:51 pm Post subject: How from the Auto Assemble wrote the following syntax |
|
|
Code: |
math.sqrt( math.pow( xa - xb, 2 ) + math.pow( ya - yb, 2 ) + math.pow( za - zb, 2 )) |
thank you ~! |
|
Back to top |
|
 |
Gniarf Grandmaster Cheater Supreme
Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Mon Sep 03, 2012 10:21 pm Post subject: |
|
|
Code: | fld qword [xa] //st0=xa
fsub qword [xb] //st0=xa-xb
fmul st(0) //st0=(xa-xb)^2
fld qword [ya] //st0=ya , st1=(xa-xb)^2
fsub qword [yb] //st0=ya-yb
fmul st(0) //st0=(ya-yb)^2
fld qword [za] //st0=za , st1=(ya-yb)^2 , st2=(xa-xb)^2
fsub qword [zb] //st0=za-zb
fmul st(0) //st0=(za-zb)^2
faddp st(2),st(0)//st0=(ya-yb)^2 , st1=(xa-xb)^2+(za-zb)^2
faddp st(1),st(0)//st0=(xa-xb)^2+(za-zb)^2+(ya-yb)^2
fsqrt //st0=sqrt( (xa-xb)^2 + (za-zb)^2 + (ya-yb)^2 )
fstp qword [result] //store the resut |
Replace qword by dword if you're using floats instead of doubles. |
|
Back to top |
|
 |
yui0900826 Cheater
Reputation: 0
Joined: 09 Aug 2011 Posts: 35 Location: HongKong
|
Posted: Mon Sep 03, 2012 11:34 pm Post subject: |
|
|
thank you  |
|
Back to top |
|
 |
|