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

Function vm_VectorNormalize

scripts/osiris_vector.h:318–332  ·  view source on GitHub ↗

Normalize a vector. Returns: the magnitude before normalization

Source from the content-addressed store, hash-verified

316// Normalize a vector.
317// Returns: the magnitude before normalization
318float vm_VectorNormalize(vector *a) {
319 float mag;
320
321 mag = vm_GetMagnitude(a);
322
323 if (mag > 0)
324 *a /= mag;
325 else {
326 *a = Zero_vector;
327 a->x = 1.0;
328 mag = 0.0f;
329 }
330
331 return mag;
332}
333
334float vm_GetMagnitude(vector *a) {
335 float f;

Callers 15

SpewEverythingMethod · 0.70
SetModeMethod · 0.70
DoIntervalMethod · 0.70
DoFrameMethod · 0.70
DoInitMethod · 0.70
DoStealMethod · 0.70
ComputeNextNestPntMethod · 0.70
CallEventMethod · 0.70
CallEventMethod · 0.70
DoInitMethod · 0.70
DoSquadieFrameMethod · 0.70

Calls 1

vm_GetMagnitudeFunction · 0.70

Tested by

no test coverage detected