fu5ha/ultraviolet

Conversion from Mat4 to Mat3

expenses opened this issue · 3 comments

It'd be nice to have a helper function to convert from a Mat4 to a Mat3 by taking the top-left corner of the matrix.

fu5ha commented

Agreed, not sure what the naming scheme should be. I personally like truncate though some others didn't like that, maybe just to_mat3?

truncate would be fine for documentation but pretty vague if you're just reading someone's code with type inference. I think being explicit about the what part of the 4x4 matrix is used would be good. Is there a good name for that top-left 3x3 matrix? Maybe something like to_top_left_mat3 or is that too long?

Would it make sense to follow the same naming pattern as extract_rotation(), since it's effectively the same operation?