Converting an angle into a different value

39 Views Asked by At

I hope i can ask this question. Its cleary related to some field of math, where as i dont know how its called..In fact, i cant even describe the problems in terms that a professional would understand in a few words (topic).

picture example

The green and red dot represent a starship each.

Based upon the angle between both starships (they are shooting each) other, i want to calculate a a chance to hit that specific target from that angle.

Starships have fixed hit chances for the 4 major locations, front/aft/port/board or 0/180/90/270 respectivly. However, if the firing angle is between those arcs, i want to calculate a mixed hitchances based on the two nearest profile values.

In the example below, a angle of 45 degree would certainly result in 77.5% (70 + 85/2). However, for 44 or 46 degree im already unsure.

However, for any hit angle between 0 and 90, excluding 45, i dont know i would calculate the...average ? for that specific angle. Can anyone advice ?

1

There are 1 best solutions below

2
On BEST ANSWER

You could probably use something that mathematicians call "linear interpolation". It's really just a more general version of the technique you used to get a value for 45 degrees.

Suppose you know the probabilities $P_A$ and $P_B$ for two angles $A$ and $B$. Now we want to calculate the probability $P_C$ for some other angle $C$, where $A \le C \le B$.

The linear interpolation formula is: $$ P_C = \frac{(B-C)P_A + (C-A)P_B }{B - A} $$ Note that:

  • When $C=A$, the formula gives $P_A$
  • When $C=B$, the formula gives $P_B$
  • When $C$ is between $A$ and $B$, you get a result that's between $P_A$ and $P_B$
  • If $C = \tfrac12(A+B)$, then $P_C = \tfrac12(P_A+P_B)$

Example 1:
Suppose $A = 0$ and $B=90$, and the corresponding probabilities are $P_A = 70$ and $P_B = 85$. If $C=45$, then $$ P_C = \frac{(90-45)*(70) + (45-0)*(85) }{90 - 0} = 77.5 $$ Example 2:
Suppose $A = 0$ and $B=90$, and the corresponding probabilities are $P_A = 70$ and $P_B = 85$. If $C=30$, then $$ P_C = \frac{(90-30)*(70) + (30-0)*(85) }{90 - 0} = 75 $$