MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / CollideExtractAnglesFromMatrix

Function CollideExtractAnglesFromMatrix

physics/collide.cpp:1492–1521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1490}
1491
1492vector *CollideExtractAnglesFromMatrix(vector *a, matrix *m) {
1493 float sinh, cosh, sinp, sinb;
1494
1495 sinh = -m->fvec.x;
1496 if (sinh < -1.0f)
1497 sinh = -1.0f;
1498 else if (sinh > 1.0f)
1499 sinh = 1.0f;
1500 a->y = asin(sinh);
1501
1502 cosh = cos(a->y);
1503 ASSERT(cosh != 0.0);
1504
1505 sinp = m->fvec.y / cosh;
1506 if (sinp < -1.0f)
1507 sinp = -1.0f;
1508 else if (sinp > 1.0f)
1509 sinp = 1.0f;
1510
1511 sinb = m->uvec.x / cosh;
1512 if (sinb < -1.0f)
1513 sinb = -1.0f;
1514 else if (sinb > 1.0f)
1515 sinb = 1.0f;
1516
1517 a->x = asin(sinp);
1518 a->z = asin(sinb);
1519
1520 return a;
1521}
1522
1523void ConvertEulerToAxisAmount(vector *e, vector *n, float *w) {
1524 float rotspeed = vm_GetMagnitude(e);

Callers 1

ConvertAxisAmountToEulerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected