Solve Angle C: Is it Between A & B?

  • Thread starter Thread starter Narf the Mouse
  • Start date Start date
  • Tags Tags
    Angle Mathematical
AI Thread Summary
The discussion revolves around solving the problem of determining if angle C lies between angles A and B in a line of sight algorithm for a roguelike game. The specific challenge involves handling blocking angles that span from 45 to 225 degrees and vice versa, which complicates the algorithm due to the need for consistent results across all angles. The user seeks a way to manage these angles within a single equation rather than splitting them into 90-degree increments, which would require extensive rewriting. Current solutions involve checking if an angle falls within a range but struggle with the counter-clockwise interpretation of angles. The user is looking for a more efficient and comprehensive solution to this blocking angle issue.
Narf the Mouse
Messages
11
Reaction score
0
...including cases such as between 45 and 225 degrees and between 225 and 45 degrees going the other way.

Which, for programmatical reasons, must all be handled in the same equation.

It's either that, or I re-work my roguelikes' LOS aglorithm to handle everything in 90 degree increments.

Save me a bunch of re-writing?

Thanks.
 
Mathematics news on Phys.org


No idea what you are asking for.

x > 45 and x < 225 does the trick.
 


Narf the Mouse said:
...including cases such as between 45 and 225 degrees and between 225 and 45 degrees going the other way.

Which, for programmatical reasons, must all be handled in the same equation.

It's either that, or I re-work my roguelikes' LOS aglorithm to handle everything in 90 degree increments.

Save me a bunch of re-writing?

Thanks.

Please Explain your problem clearly.
 


How are you "given" the angle?
 


More clearly, it's for a line of sight algorithm for a roguelike. If the algorithm encounters a blocking tile, it generates a blocking angle range - minimum and maximum - produced by said tile. Thereafter, anything which is entirely obscured by said angle - Anything whos corner and middle angles are all inside the blocking angle range - Is naturally not visible.

I also compile all intersecting blocking angles, so as to reduce overhead.

The problem comes with a blocking angle from, say, 45 to 225 or vice-versa, by way of 0/360 instead of 180. That is to say, clockwise from 45 to 225. The algorith tends to think that 45 to 225, counter-clockwise, is blocked.

The conflict comes because the same algorithm must be used for all angles to obtain consistent results.

I've hacked a solution by spitting it into two halves, but I've been unable to find a complete solution on google.
 
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top