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

Function vm_NormalizeVectorFast

vecmat/vector.cpp:453–468  ·  view source on GitHub ↗

Normalize a vector using an approximation of the magnitude Returns: the magnitude before normalization

Source from the content-addressed store, hash-verified

451// Normalize a vector using an approximation of the magnitude
452// Returns: the magnitude before normalization
453float vm_NormalizeVectorFast(vector *a) {
454 float mag;
455
456 mag = vm_GetMagnitudeFast(a);
457
458 if (mag == 0.0) {
459 a->x = a->y = a->z = 0.0;
460 return 0;
461 }
462
463 a->x = (a->x / mag);
464 a->y = (a->y / mag);
465 a->z = (a->z / mag);
466
467 return mag;
468}
469
470// Computes the distance from a point to a plane.
471// Parms: checkp - the point to check

Callers 15

RenderSubmodelFaceFunction · 0.85
vm_GetNormalizedDirFastFunction · 0.85
DoWallEffectsFunction · 0.85
ApplyLightingToSubmodelFunction · 0.85
ApplyVolumeLightToObjectFunction · 0.85
ApplyLightingToRoomsFunction · 0.85
DrawPlayerNameOnHudFunction · 0.85
CreateSubobjectDebrisFunction · 0.85
DoConcussiveForceFunction · 0.85

Calls 1

vm_GetMagnitudeFastFunction · 0.70

Tested by

no test coverage detected