MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / v_euler_from_quat

Function v_euler_from_quat

include/vecmath/dag_vecMath_common.h:1386–1408  ·  view source on GitHub ↗

.xyz = heading, attitude, bank

Source from the content-addressed store, hash-verified

1384
1385// .xyz = heading, attitude, bank
1386VECTORCALL inline vec3f v_euler_from_quat(quat4f quat)
1387{
1388 vec4f test = v_dot2(v_perm_xzxz(quat), v_perm_ywyw(quat));
1389 vec4f testSign = v_and(test, V_CI_SIGN_MASK);
1390 vec4f testAbs = v_xor(test, testSign);
1391 vec4f specialCase = v_cmp_ge(testAbs, v_splats(0.49999f));
1392 vec4f m1 = v_perm_xxyy(quat);
1393 vec4f m2 = v_perm_zwzw(quat);
1394 vec4f m = v_mul(m1, m2);
1395 vec4f s = v_rot_2(v_perm_yyww(m));
1396 vec4f x = v_sub(s, m);
1397 vec4f qSq = v_sqr(quat);
1398 vec4f y = v_sub(V_C_HALF, v_add(v_perm_yzxw(qSq), v_splat_z(qSq)));
1399 x = v_sel(x, quat, specialCase);
1400 y = v_sel(y, v_splat_w(quat), specialCase);
1401 vec4f attX = v_add(test, test);
1402 vec4f attY = v_cos_from_sin_x(attX);
1403 x = v_sel(x, attX, V_CI_MASK0100);
1404 y = v_sel(y, v_splat_x(attY), V_CI_MASK0100);
1405 vec4f angles = v_atan2(x, y);
1406 vec4f specialAngles = v_perm_xycd(v_or(v_perm_xaxa(v_add_x(angles, angles), V_C_HALFPI), testSign), v_zero());
1407 return v_sel(angles, specialAngles, specialCase);
1408}
1409
1410VECTORCALL inline quat4f v_quat_slerp(vec4f t, quat4f a, quat4f b)
1411{

Callers 1

euler_from_quat_vecFunction · 0.85

Calls 15

v_sqrFunction · 0.85
v_cos_from_sin_xFunction · 0.85
v_atan2Function · 0.85
v_dot2Function · 0.70
v_perm_xzxzFunction · 0.70
v_perm_ywywFunction · 0.70
v_andFunction · 0.70
v_xorFunction · 0.70
v_cmp_geFunction · 0.70
v_splatsFunction · 0.70
v_perm_xxyyFunction · 0.70
v_perm_zwzwFunction · 0.70

Tested by

no test coverage detected