Skip to main content
gamedev.net
🔒 Locked

angle interval intersection

Started by mooserman352 Jan 5, 2007 at 9:45 PM 1 replies 900+ views
Original Post
mooserman352
mooserman352
I have a few intervals of angles with all the angles in radians and in between 0 and 2 PI. For regular intervals {[Ai, Bi] i=1,2...n} on the real line, the intersection would be [max({Ai}),min({Bi})] if max({Ai})<min({Bi})], and the null set otherwise. But how would you do this for angles?
jdindia
jdindia
There really aren't any tricks for handling things in a modulo space. Basically you have a few 'if' statements and you check the possibilities. For example, if you wanted to find the shortest distance between two angles (a<b), you calculate the standard distance b-a, and then you calculate the distance going the other way around a+2pi-b. Draw some diagrams of the different cases and be extra careful that you're getting all the possibilities. It can be helpful to sort things (eg, a<b) to simplify the number of cases.
Zipster
Zipster
Keep in mind that any interval [a,b] is the same as ~[b,a] (the complement of the reverse range), meaning that [b,a] is the complement of [a,b]. So when you're comparing two intervals A and B, if B has b
Edit: I should note that you have to implement the minus operation X - Y specially instead of doing X ∩ ~Y, because if X and Y both have a
[Edited by - Zipster on January 6, 2007 4:57:09 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.