-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
euler_to_quat_lh also some euler_to_quat bugfixes #377
Conversation
… the lh file. Made a handed struct file so I remember to do that
… euler to quat struct.
…->mat4->quat tests because there is no left handed version of those. But I could try to find a way to change it
…otta decide what to name the macros for controlling lefthand and also make call functions for rh and lh conditionally declared
For left handed operations in the future, do you think it will be nessesary to have CGLM_EULER_CONTROL_RH_BIT. It fits with the style but for euler, there is only left or right so we can just use CGLM_FORCE_LEFT_HANDED in the code. #define CGLM_EULER_CONTROL_RH_BIT (1 << 0) /* LEFT_HANDED, For DirectX, Metal, Vulkan / #ifdef CGLM_FORCE_LEFT_HANDED |
Also, the only difference between euler to quat rh vs lh is that the zsin part is negative. This might be helpful info for someone I think. |
Many thanks @telephone001 for the work! For now, I think it is enough to continue with
that would makes it easy to maintain. But we can rewrite xyz: // rH
dest[0] = xc * ys * zs + xs * yc * zc;
dest[1] = xc * ys * zc - xs * yc * zs;
dest[2] = xc * yc * zs + xs * ys * zc;
dest[3] = xc * yc * zc - xs * ys * zs;
// Lh
dest[0] = xs * yc * zc - xc * ys * zs;
dest[1] = xc * ys * zc + xs * yc * zs;
dest[2] = xs * ys * zc - xc * yc * zs;
dest[3] = xc * yc * zc + xs * ys * zs; by keeping this part same: xs = sinf(angles[0] * 0.5f); xc = cosf(angles[0] * 0.5f);
ys = sinf(angles[1] * 0.5f); yc = cosf(angles[1] * 0.5f);
zs = sinf(angles[2] * 0.5f); zc = cosf(angles[2] * 0.5f); not sure yet but maybe we can apply some simd on these in the future and separate implementations would make things easier. Or maybe negating single angle then applying same implementation will be better choice. For now we can continue as your implementation. Adding I guess we are ready to merge the PR? |
@recp |
@telephone001 thanks for your contributions, the PR is merged 🚀 |
Creates euler_to_quat_lh
makes euler_to_quat_rh and lh struct functions
fixes up euler_to_quat documentation
made it early so I remember about it