## Recommended Posts

Okay. I'm trying to find the measure of an angle. My code is what I think should be working but some funny things are happening. About 2/3 times, it doesn't even give me an angle and the other 1/3 of the time, the numbers are ususally between 50-90 or -50 through -90 though I don't know why. I have iscolated the problem to the _degree() thing but I'm not sure what's wrong with it. Many of the commented out things are my attempts at fixing it so i'll leave them in here. I might not of done something right so please try the things I tried again. Also, I am including the math.au3. thanks.

```Func code()
\$win = WinGetPos("    P§   ")
\$pos = MouseGetPos()
\$x_move = \$pos - \$win - 105
\$y_move = \$pos - \$win - 97
\$distance = ""
If \$text <> "" Then
\$distance = Sqrt ( (\$x_move - \$x_old)^2 + (\$y_move - \$y_old)^2 )
\$feet1 = Floor(\$distance / 12)
\$feet2 = Round(\$distance - (\$feet1 * 12),1)
\$feet = " OR " & \$feet1 & "'" & \$feet2 & '" '
;\$value1 = ATan((\$y_move1 - \$y_old1)/(\$x_move1 - \$x_old1))
;\$value = _Degree(\$value1)
\$value = _Degree( ATan((\$y_move - \$y_old)/(\$x_move - \$x_old)) )
;MsgBox(0,"",\$value & "   " & (\$y_move1 - \$y_old1)/(\$x_move1 - \$x_old1))
\$text = \$text & "(" & \$x_move & "," & \$y_move & ") Distance is: " & \$distance & \$feet & \$value & @CRLF
EndIf
If \$text = "" Then \$text = "(" & \$x_move & "," & \$y_move & ")" & @CRLF
\$x_old = \$x_move
\$y_old = \$y_move
GUICtrlCreateInput(\$text,50,400,700,150,"0x00201004")
GUISetState()

EndFunc```

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...