MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / normalize

Method normalize

core/math/vector4.cpp:89–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void Vector4::normalize() {
90 real_t lengthsq = length_squared();
91 if (lengthsq == 0) {
92 x = y = z = w = 0;
93 } else {
94 real_t length = Math::sqrt(lengthsq);
95 x /= length;
96 y /= length;
97 z /= length;
98 w /= length;
99 }
100}
101
102Vector4 Vector4::normalized() const {
103 Vector4 v = *this;

Callers 2

normalizedMethod · 0.45
direction_toMethod · 0.45

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected