Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1.  
  2.  
  3. Atan2(y,x)
  4. {
  5. global Pi
  6.  
  7. return (x > 0 ? Atan(y/x)
  8. : ((y >= 0 AND x < 0) ? (Atan(y/x) + 3.14159)
  9. : ((y < 0 AND x < 0) ? (Atan(y/x) - 3.14159)
  10. : ((y > 0 AND x = 0) ? 3.14159/2
  11. : ((y < 0 AND x = 0) ? -3.14159/2 : "")))))
  12. }
  13.  
  14.  
  15. SetFormat, Float, 0.3
  16. FileDelete, calc.txt
  17. Gui, Font, S12 Tahoma
  18. GUI, add, text , x10 Y10 h30 w100 , Current Pos x
  19. GUI, add, text , x160 Y10 h30 w100 , Current Pos z
  20. GUI, add, edit , x10 y30 W100 Vnumber1,
  21. GUI, add, edit , x160 y30 W100 Vnumber2,
  22. GUI, add, text , x10 Y70 h30 w100 , Destina Pos x
  23. GUI, add, text , x160 Y70 h30 w100 , Destina Pos z
  24. GUI, add, edit , x10 y100 W100 Vnumber3,
  25. GUI, add, edit , x160 y100 W100 Vnumber4,
  26. GUI, add, button, x10 y150 h20 w40 gAdd , Time
  27. GUI, add, button, x60 y150 h20 w80 gDiv , Heading
  28. GUI, add, button, x10 y310 h20 w50 gClose, Close
  29. GUI, add, button, x70 y310 h20 w50 gClear, Clear
  30. GUI, add, Edit, x10 y170 h100 w200 VOutcome ReadOnly,
  31. GUI, show, H350 W270, H1Z1 Calc
  32. return
  33.  
  34. Add:
  35. sign = +
  36. gosub, calc
  37. Return
  38.  
  39. Sub:
  40. sign = -
  41. gosub, calc
  42. Return
  43.  
  44. Mult:
  45. sign = *
  46. gosub, calc
  47. Return
  48.  
  49. Div:
  50. sign = /
  51. gosub, calc
  52. Return
  53.  
  54. Close:
  55. ExitApp
  56.  
  57. calc:
  58. GUI, submit, NoHide
  59. If sign = +
  60. {
  61. out := 0.002705*(sqrt((number3-number1)*(number3-number1)+(number4-number2)*(number4-number2)))
  62. }
  63.  
  64. If sign = -
  65. {
  66. out := (number1 – number2)
  67. }
  68. If sign = *
  69. {
  70. out:= (number1 * number2)
  71. }
  72. If Sign = /
  73. {
  74. out := (atan2((number3-number1),(number4-number2)))
  75. }
  76.  
  77. Fileappend, %out% `r`n, calc.txt
  78. Fileread, list, calc.txt
  79. GuiControl, , Outcome, %list%
  80. Return
  81.  
  82. Clear:
  83. FileDelete, calc.txt
  84. GUI, add, Edit, x10 y170 h100 w200 ReadOnly,
  85. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement