zutto Posted April 6, 2009 Share Posted April 6, 2009 yap, i fail, i cant figure out howto make it think thats shortest way, it always fails with the 0.00 angle :/i am not going with 360, i am going with radians[i am pretty sure ;? fix me if i am wrong.] {2*pi but that shouldnt matter.}.. i think pics will tell you more.and here how it should begive me some ideas PS. My paint skills, ftw! Link to comment Share on other sites More sharing options...
monoceres Posted April 6, 2009 Share Posted April 6, 2009 Could it be so easy that you've missed the fact that the yellow dot is not at angle 0 but rather 90° (or π/2 if you want). That's how the unit circle works anyway. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Alek Posted April 6, 2009 Share Posted April 6, 2009 some old function I used once for this, not sure if it works or not. It returns an array, where [0] is direction and [1] is angle difference. [0] can be 1 or -1 (-1 for left and 1 for right I think) Func _Between($s_Next_Rot, $s_Cur_Rot) Local $Array[2] If $s_Cur_Rot > $s_Next_Rot Then If ($s_Cur_Rot - $s_Next_Rot) < 181 Then $Array[0] = 1 $Array[1] = $s_Cur_Rot - $s_Next_Rot Else $Array[0] = -1 $Array[1] = (($s_Next_Rot + 360) - $s_Cur_Rot) EndIf Else If ($s_Next_Rot - $s_Cur_Rot) < 181 Then $Array[0] = -1 $Array[1] = $s_Next_Rot - $s_Cur_Rot Else $Array[0] = 1 $Array[1] = (($s_Cur_Rot + 360) - $s_Next_Rot) EndIf EndIf Return $Array EndFunc [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
zutto Posted April 7, 2009 Author Share Posted April 7, 2009 (edited) some old function I used once for this, not sure if it works or not. It returns an array, where [0] is direction and [1] is angle difference. [0] can be 1 or -1 (-1 for left and 1 for right I think) Func _Between($s_Next_Rot, $s_Cur_Rot) Local $Array[2] If $s_Cur_Rot > $s_Next_Rot Then If ($s_Cur_Rot - $s_Next_Rot) < 181 Then $Array[0] = 1 $Array[1] = $s_Cur_Rot - $s_Next_Rot Else $Array[0] = -1 $Array[1] = (($s_Next_Rot + 360) - $s_Cur_Rot) EndIf Else If ($s_Next_Rot - $s_Cur_Rot) < 181 Then $Array[0] = -1 $Array[1] = $s_Next_Rot - $s_Cur_Rot Else $Array[0] = 1 $Array[1] = (($s_Cur_Rot + 360) - $s_Next_Rot) EndIf EndIf Return $Array EndFunc going to try that EDIT: fails like my method i used earlier, if your rotation is like.. 5.20 and target is 0.89 it will go right, instead of going left :/ Could it be so easy that you've missed the fact that the yellow dot is not at angle 0 but rather 90° (or π/2 if you want). That's how the unit circle works anyway. wasnt the point that it wasnt on exactly 0, was just example Edited April 7, 2009 by zutto Link to comment Share on other sites More sharing options...
TerarinK Posted April 7, 2009 Share Posted April 7, 2009 http://math2.org/math/geometry/circles.htm 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now