Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Best rotation

Author
Message
Lame Brain
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location: Portland, OR
Posted: 14th Nov 2005 16:30
I'm not sure of how to even pose the question, but how do you find the best rotation to reach a certain angle?

What I mean is, lets say you have an object facing 75, you want to rotate the angle to 230, how do you determine wether to turn right or left?

Another hair-brained idear from... LAME BRAIN!
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 14th Nov 2005 16:50
function rodir(ang,target)
if wrapvalue(ang+180)<target
direction=-1
else
direction=1
endif
endfunction direction


should work ok, its a function that returns -1 for turn anticlockwise and 1 for turn clockwise, I hope thats some help to you, it uses integer angles btw, it`s not often you need fractional angles, it`s easy enough to alter if needs be, cheers.



if there is one thing I can NOT tolerate, it`s intolerant people.
Lame Brain
19
Years of Service
User Offline
Joined: 28th Apr 2005
Location: Portland, OR
Posted: 14th Nov 2005 16:58
You can always tell you got a good answer when you look at it and realize that all this time you've been looking at your problem and making it too complex.

Thank you Me! thats a pretty slick function.

Another hair-brained idear from... LAME BRAIN!

Login to post a reply

Server time is: 2024-11-27 12:32:35
Your offset time is: 2024-11-27 12:32:35