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

Function vm_GetMagnitudeFast

vecmat/vector.cpp:421–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421float vm_GetMagnitudeFast(vector *v) {
422 float a, b, c, bc;
423
424 a = fabs(v->x);
425 b = fabs(v->y);
426 c = fabs(v->z);
427
428 if (a < b) {
429 float t = a;
430 a = b;
431 b = t;
432 }
433
434 if (b < c) {
435 float t = b;
436 b = c;
437 c = t;
438
439 if (a < b) {
440 float t = a;
441 a = b;
442 b = t;
443 }
444 }
445
446 bc = (b / 4) + (c / 8);
447
448 return a + bc + (bc / 2);
449}
450
451// Normalize a vector using an approximation of the magnitude
452// Returns: the magnitude before normalization

Callers 15

vm_VectorDistanceQuickFunction · 0.70
vm_NormalizeVectorFastFunction · 0.70
vm_GetCentroidFastFunction · 0.70
GetFormFactorForElementFunction · 0.50
ApplyVolumeLightToObjectFunction · 0.50
ApplyLightingToTerrainFunction · 0.50
SetupMineObjectFunction · 0.50
DrawPowerupGlowDiskFunction · 0.50
DrawPlayerInvulSphereFunction · 0.50
DrawStarsFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected