-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
Hi,
I am not sure if I am missing something so please correct me if there already is an easier way to do this. Here's what I want to do:
- Convert a
mat4transformation matrix to amat3rotation matrix (essentially dropping the translation part) - Convert it back to a
mat4with the translation part set to{0, 0, 0}
This is a pretty common operation for a bunch of 3D rendering related tasks. I have been doing that manually so far (the types are just linalg typedefs):
auto skyboxViewRot = Mat3f { transform.x.xyz(), transform.y.xyz(), transform.z.xyz() };
auto skyboxView = Mat4f { Vec4f { skyboxViewRot.x, 0.0f },
Vec4f { skyboxViewRot.y, 0.0f },
Vec4f { skyboxViewRot.z, 0.0f },
Vec4f { 0.0f, 0.0f, 0.0f, 1.0f } };
I am pretty sure in glm the mat3 and mat4 constructors allow you to do this as one liners. Is there a similar way to achieve this in linalg? Otherwise I think it might be useful to add utilities for these operations (not sure if this is beyond the scope of the library but these seem to be very common operations to me).
Thanks!
tcoppex
Metadata
Metadata
Assignees
Labels
No labels