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.

Code Snippets / WrapAngToAng

Author
Message
robo cat
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 29th Mar 2005 19:20
This is a little function I've been using for ages now and thought I'd post it up, as its proved to be very useful.

Heres one for using floats:



Heres for integers:



To wrap angle a to angle b by degrees 3 you would use:
a = WrapAngToAng(a, b, 3)

Of course just choose which function you want.

There may be a faster way to do it, but hope its useful.

Simple... yet fun!
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 30th Mar 2005 02:47
Why not add it to the code base?

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
robo cat
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 30th Mar 2005 18:41
Yeh, I think I'll do that.

Simple... yet fun!
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Apr 2005 12:17
What do you mean by "wrap angle A to angle B by 3 degrees"?
Wrapping means this: if you wrap angle A(50) to angle B(20) then the result would be 10.



Maybe I misunderstood what your code is suppose to do?

PETA - People for the Eating of Tasty Animals
robo cat
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 4th May 2005 04:09
Wrap angle is just the noobish name I gave to it when I created it years ago - its kinda just stuck ever since. A more appropriate name would be smooth angle as if you have A = 50 and B = 20 and do it by 3 degrees it would return 47.

Simple... yet fun!
Kohaku
21
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 4th May 2005 12:57
Sounds like another version of curveangle. I heard curveangle could be slow, I'm not sure myself, but this could be a good alternative if it's faster.

You are not alone.

Login to post a reply

Server time is: 2025-05-18 04:55:55
Your offset time is: 2025-05-18 04:55:55