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

Method is_normalized

core/math/vector2.cpp:75–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool Vector2::is_normalized() const {
76 // use length_squared() instead of length() to avoid sqrt(), makes it more stringent.
77 return Math::is_equal_approx(length_squared(), 1, (real_t)UNIT_EPSILON);
78}
79
80real_t Vector2::distance_to(const Vector2 &p_vector2) const {
81 return Math::sqrt((x - p_vector2.x) * (x - p_vector2.x) + (y - p_vector2.y) * (y - p_vector2.y));

Callers 2

slideMethod · 0.45
reflectMethod · 0.45

Calls 1

is_equal_approxFunction · 0.70

Tested by

no test coverage detected