MCPcopy Create free account
hub / github.com/axmolengine/axmol / normalize_point

Function normalize_point

core/2d/ParticleSystem.cpp:83–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81//
82
83inline void normalize_point(float x, float y, particle_point* out)
84{
85 float n = x * x + y * y;
86 // Already normalized.
87 if (n == 1.0f)
88 return;
89
90 n = sqrt(n);
91 // Too close to zero.
92 if (n < MATH_TOLERANCE)
93 return;
94
95 n = 1.0f / n;
96 out->x = x * n;
97 out->y = y * n;
98}
99
100ParticleData::ParticleData()
101{

Callers 1

updateMethod · 0.85

Calls 1

sqrtFunction · 0.50

Tested by

no test coverage detected