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

Function vm_NormalizeVector

vecmat/vector.cpp:274–288  ·  view source on GitHub ↗

Normalize a vector. Returns: the magnitude before normalization

Source from the content-addressed store, hash-verified

272// Normalize a vector.
273// Returns: the magnitude before normalization
274float vm_NormalizeVector(vector *a) {
275 float mag;
276
277 mag = vm_GetMagnitude(a);
278
279 if (mag > 0)
280 *a /= mag;
281 else {
282 *a = Zero_vector;
283 a->x = 1.0;
284 mag = 0.0f;
285 }
286
287 return mag;
288}
289
290float vm_GetMagnitude(vector *a) {
291 float f;

Callers 15

g3_Point2VecFunction · 0.85
g3_SetCustomClipPlaneFunction · 0.85
ComputePlayInfoMethod · 0.85
PlaySound3dMethod · 0.85
AdjustSoundMethod · 0.85
vm_GetNormalFunction · 0.85
vm_GetNormalizedDirFunction · 0.85
vm_OrthogonalizeFunction · 0.85
DoVectorToMatrixFunction · 0.85
vm_DeltaAngVecFunction · 0.85
do_physics_simFunction · 0.85

Calls 1

vm_GetMagnitudeFunction · 0.70

Tested by

no test coverage detected