compute inverse cosine
| 192 | |
| 193 | // compute inverse cosine |
| 194 | angle FixAcos(float v) { |
| 195 | fix vv; |
| 196 | int i, f, aa; |
| 197 | |
| 198 | vv = FloatToFix(std::fabs(v)); |
| 199 | |
| 200 | if (vv >= F1_0) // check for out of range |
| 201 | return 0; |
| 202 | |
| 203 | i = (vv >> 8) & 0xff; |
| 204 | f = vv & 0xff; |
| 205 | |
| 206 | aa = acos_table[i]; |
| 207 | aa = aa + (((acos_table[i + 1] - aa) * f) >> 8); |
| 208 | |
| 209 | if (v < 0) |
| 210 | aa = 0x8000 - aa; |
| 211 | |
| 212 | return aa; |
| 213 | } |
| 214 | |
| 215 | // given cos & sin of an angle, return that angle. |
| 216 | // parms need not be normalized, that is, the ratio of the parms cos/sin must |
no outgoing calls
no test coverage detected