Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Atan2(y,x)
- {
- global Pi
- return (x > 0 ? Atan(y/x)
- : ((y >= 0 AND x < 0) ? (Atan(y/x) + 3.14159)
- : ((y < 0 AND x < 0) ? (Atan(y/x) - 3.14159)
- : ((y > 0 AND x = 0) ? 3.14159/2
- : ((y < 0 AND x = 0) ? -3.14159/2 : "")))))
- }
- SetFormat, Float, 0.3
- FileDelete, calc.txt
- Gui, Font, S12 Tahoma
- GUI, add, text , x10 Y10 h30 w100 , Current Pos x
- GUI, add, text , x160 Y10 h30 w100 , Current Pos z
- GUI, add, edit , x10 y30 W100 Vnumber1,
- GUI, add, edit , x160 y30 W100 Vnumber2,
- GUI, add, text , x10 Y70 h30 w100 , Destina Pos x
- GUI, add, text , x160 Y70 h30 w100 , Destina Pos z
- GUI, add, edit , x10 y100 W100 Vnumber3,
- GUI, add, edit , x160 y100 W100 Vnumber4,
- GUI, add, button, x10 y150 h20 w40 gAdd , Time
- GUI, add, button, x60 y150 h20 w80 gDiv , Heading
- GUI, add, button, x10 y310 h20 w50 gClose, Close
- GUI, add, button, x70 y310 h20 w50 gClear, Clear
- GUI, add, Edit, x10 y170 h100 w200 VOutcome ReadOnly,
- GUI, show, H350 W270, H1Z1 Calc
- return
- Add:
- sign = +
- gosub, calc
- Return
- Sub:
- sign = -
- gosub, calc
- Return
- Mult:
- sign = *
- gosub, calc
- Return
- Div:
- sign = /
- gosub, calc
- Return
- Close:
- ExitApp
- calc:
- GUI, submit, NoHide
- If sign = +
- {
- out := 0.002705*(sqrt((number3-number1)*(number3-number1)+(number4-number2)*(number4-number2)))
- }
- If sign = -
- {
- out := (number1 – number2)
- }
- If sign = *
- {
- out:= (number1 * number2)
- }
- If Sign = /
- {
- out := (atan2((number3-number1),(number4-number2)))
- }
- Fileappend, %out% `r`n, calc.txt
- Fileread, list, calc.txt
- GuiControl, , Outcome, %list%
- Return
- Clear:
- FileDelete, calc.txt
- GUI, add, Edit, x10 y170 h100 w200 ReadOnly,
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement