MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Normalize

Method Normalize

Source/Engine/Core/Math/Vector2.h:241–250  ·  view source on GitHub ↗

Performs vector normalization (scales vector up to unit length).

Source from the content-addressed store, hash-verified

239 /// Performs vector normalization (scales vector up to unit length).
240 /// </summary>
241 void Normalize()
242 {
243 const T length = Math::Sqrt(X * X + Y * Y);
244 if (length >= ZeroTolerance)
245 {
246 const T invLength = (T)1.0f / length;
247 X *= invLength;
248 Y *= invLength;
249 }
250 }
251
252public:
253 Vector2Base operator+(const Vector2Base& b) const

Callers 2

GetNormalizedMethod · 0.45
SlerpMethod · 0.45

Calls 1

SqrtFunction · 0.70

Tested by

no test coverage detected