MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / FixAcos

Function FixAcos

fix/fix.cpp:194–213  ·  view source on GitHub ↗

compute inverse cosine

Source from the content-addressed store, hash-verified

192
193// compute inverse cosine
194angle 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

Callers 2

FixAtan2Function · 0.70
vm_DeltaAngVecNormFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected