MCPcopy Create free account
hub / github.com/demoth/jake2 / VectorNormalize

Method VectorNormalize

qcommon/src/main/java/jake2/qcommon/util/Math3D.java:96–106  ·  view source on GitHub ↗
(float[] v)

Source from the content-addressed store, hash-verified

94 to[2] = veca[2] + scale * vecb[2];
95 }
96 public static final float VectorNormalize(float[] v) {
97
98 float length = VectorLength(v);
99 if (length != 0.0f) {
100 float ilength = 1.0f / length;
101 v[0] *= ilength;
102 v[1] *= ilength;
103 v[2] *= ilength;
104 }
105 return length;
106 }
107 public static final float VectorLength(float v[]) {
108 return (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
109 }

Callers 15

testMapMethod · 0.95
RailTrailMethod · 0.95
HeatbeamMethod · 0.95
RailTrailMethod · 0.95
putInFrontOfCreatorMethod · 0.95
UpdateChaseCamMethod · 0.95
thinkMethod · 0.95
CheckPowerArmorMethod · 0.95
T_DamageMethod · 0.95
infrontMethod · 0.95
P_DamageFeedbackMethod · 0.95
thinkMethod · 0.95

Calls 1

VectorLengthMethod · 0.95

Tested by 4

testMapMethod · 0.76
RailTrailMethod · 0.76
HeatbeamMethod · 0.76
RailTrailMethod · 0.76