MCPcopy Create free account
hub / github.com/MyGUI/mygui / normalize

Method normalize

MyGUIEngine/src/msdfgen/core/Vector2.hpp:42–46  ·  view source on GitHub ↗

Returns the normalized vector - one that has the same direction but unit length.

Source from the content-addressed store, hash-verified

40
41 /// Returns the normalized vector - one that has the same direction but unit length.
42 inline Vector2 normalize(bool allowZero = false) const {
43 if (double len = length())
44 return Vector2(x/len, y/len);
45 return Vector2(0, !allowZero);
46 }
47
48 /// Returns a vector with the same length that is orthogonal to this one.
49 inline Vector2 getOrthogonal(bool polarity = true) const {

Callers

nothing calls this directly

Calls 2

Vector2Class · 0.85
lengthFunction · 0.50

Tested by

no test coverage detected