mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
[c] Added isNan check that shouldn't care whether the compiler is IEEE compliant or not. Closes #734.
This commit is contained in:
parent
dfa9ea5913
commit
4415cc456b
@ -198,12 +198,17 @@ static void _addAfterPosition (float p, float* temp, int i, float* out, int o) {
|
||||
out[o + 2] = r;
|
||||
}
|
||||
|
||||
static int _isNan(float value) {
|
||||
float _nan = (float)0.0/(float)0.0;
|
||||
return 0 == memcmp((void*)&value, (void*)&_nan, sizeof(value));
|
||||
}
|
||||
|
||||
static void _addCurvePosition (float p, float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2,
|
||||
float* out, int o, int/*bool*/tangents) {
|
||||
float tt, ttt, u, uu, uuu;
|
||||
float ut, ut3, uut3, utt3;
|
||||
float x, y;
|
||||
if (p == 0) p = 0.0001f;
|
||||
if (p == 0 || _isNan(p)) p = 0.0001f;
|
||||
tt = p * p, ttt = tt * p, u = 1 - p, uu = u * u, uuu = uu * u;
|
||||
ut = u * p, ut3 = ut * 3, uut3 = u * ut3, utt3 = ut3 * p;
|
||||
x = x1 * uuu + cx1 * uut3 + cx2 * utt3 + x2 * ttt, y = y1 * uuu + cy1 * uut3 + cy2 * utt3 + y2 * ttt;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user