TuanGe's blog

By TuanGe, history, 3 years ago, In English

Meet a problem, but can't find solutions on internet. I know here are smartest people, so hope can get some help.

The problem is, starting from 0 degree, we rotate theta every time, theta is a floating point, like 33.7 degree. So now we have an array of angle with length of n, r = [0, theta, 2*theta, ..., (n-1)*theta] (wrap to [0..2*PI]).

And we are given an start index a and end index b, how can we quickly find all indices in [a..b] whose angle fall into angel range [t1..t2] (the blue area)? There could be many queries.

Really thanks for any idea, I can only think out iterating all indices one by one.

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it