API for getting subsections of a matrix #4

Closed
Robmaister opened this Issue Jan 18, 2013 · 3 comments

Projects

None yet

2 participants

@Robmaister
Collaborator

Not sure what the proper term for it is, but I think there should be some API exposed for getting the upper-left 3x3 of a Matrix4 as there are some fairly common uses for it, like calculating a normal matrix.

The main question is how do we expose it? Should there be UpperLeft, UpperRight, LowerLeft, and LowerRight properties? In that case, would any of them besides UpperLeft be useful?

Should we create a new constructor in Matrix3 that accepts a Matrix4, or will that not be clear enough? (Though it does match the GLSL way of doing it)

Any other ideas?

@andykorth
Owner

After giving this some thought, I think a constructor might be the best way to do this. I do think it's occasionally easy to miss overloaded constructors, but keeping it in line with GLSL is nice. Also, then we don't have to worry about method names, although I think UpperLeft would be fine.

I can't really think of any use for other subsections of a matrix, so my rule of thumb is always to leave out the speculative features until someone actually has a demonstrated need for it.

@Robmaister
Collaborator

Alright, awesome. I'll incorporate it in my fork and include it in the next pull request when everything's nice and stable.

@Robmaister
Collaborator

Implemented in GoldBlockGames/opentk@94c7ad4. Going to tidy up a few more things and send a pull request in a few hours.

@andykorth andykorth closed this Jan 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment