I get what you're asking. For each angle A in a list of angles, you want to know if A is included in the sector defined by the angles B and C. If B>C, then the sector starts at angle B and wraps around the 0 degree mark to end at A.
Here's some code that does what you're asking for:
#include <vector>
#include <iostream>
#include <cmath>
bool angleIsBetween(float angle, float start, float end)
{
// If angle is outside the range [0,360), convert it to the
// equivalent angle inside that range.
angle = fmod(angle, 360.0f);
// If start>end, then the angle range wraps around 0.
return (start<=end) ? (angle>=start && angle<=end)
: (angle>=start || angle<=end);
}
int main()
{
float angles[] = {0.0, 180.0, 30};
size_t nAngles = sizeof(angles)/sizeof(angles[0]);
for (size_t i=0; i<nAngles; ++i)
{
std::cout << angleIsBetween(angles[i], 30.0, 310.0) << " ";
std::cout << angleIsBetween(angles[i], 310.0, 30) << " ";
}
std::cout << "\n";
return 0;
}
This outputs: 0 1 1 0 1 1