-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
glm::adjugate ? #246
Comments
Hi @wobes1 Thanks for your feedback, We can add this function to cglm, I will work on it asap if anyone wont before me It is similar to inverse just without determinant division |
Thank you for your reply @recp Wow, I really appreciate the reactivity! Sorry I couldn't contribute myself, I lack proper knowledge of cglm and complex matrices operations, but will be happy to learn Cheers EDIT: |
Yes I believe this is it: CGLM_INLINE
void glm_mat3_adjugate(mat3 mat, mat3 dest) {
float det;
float a = mat[0][0], b = mat[0][1], c = mat[0][2], d = mat[1][0], e = mat[1][1], f = mat[1][2],
g = mat[2][0], h = mat[2][1], i = mat[2][2];
dest[0][0] = e * i - f * h;
dest[0][1] = -(b * i - h * c);
dest[0][2] = b * f - e * c;
dest[1][0] = -(d * i - g * f);
dest[1][1] = a * i - c * g;
dest[1][2] = -(a * f - d * c);
dest[2][0] = d * h - g * e;
dest[2][1] = -(a * h - g * b);
dest[2][2] = a * e - b * d;
} Please let me know if something is off. Thank you! |
Yes that's it! But with correct indents/alignment ;) CGLM_INLINE
void
glm_mat3_adjugate(mat3 mat, mat3 dest) {
float a = mat[0][0], b = mat[0][1], c = mat[0][2],
d = mat[1][0], e = mat[1][1], f = mat[1][2],
g = mat[2][0], h = mat[2][1], i = mat[2][2];
dest[0][0] = e * i - f * h;
dest[0][1] = -(b * i - h * c);
dest[0][2] = b * f - e * c;
dest[1][0] = -(d * i - g * f);
dest[1][1] = a * i - c * g;
dest[1][2] = -(a * f - d * c);
dest[2][0] = d * h - g * e;
dest[2][1] = -(a * h - g * b);
dest[2][2] = a * e - b * d;
} maybe |
Hello there,
I am currently using cglm in my game engine and was wondering if there is an implementation of adjugate in cglm?
here how the function looks like from glm C++ library
Thank you.
The text was updated successfully, but these errors were encountered: