cgmath icon indicating copy to clipboard operation
cgmath copied to clipboard

Distinguish between column/row ordering at type level

Open brendanzab opened this issue 9 years ago • 1 comments

Currently cgmath only uses column vectors and column-major matrices by convention. Perhaps it would be useful to explore whether we can find a design that enforces the orientation of vectors and matrix ordering at the type level. Then perhaps we could have two separate modules with specific aliases for exporting type aliases for either column or row-major types as VectorNs and MatrixNs.

Not sure if the complexity is worth it though. I also wonder how useful it really would be for library authors.

cc. @mhintz

brendanzab avatar Apr 16 '16 00:04 brendanzab

I tend to believe it's better to select a convention, to be clear about it, and to stick to it, then simplify the API as much as possible around that convention.

The alternative is to build the API to be as flexible as possible, but then the problem becomes that users of the library will choose their own side on the convention, and two bits of code written by different people, which depend on the same library, could clash, becoming confusing, unintelligible, or at worst, misleading.

For example, imagine you use column vectors, and someone writes a great FPS camera class, but it uses row vectors. Should you go fork the code, go through and reverse the order of all matrix multiplications, so you can use it?

Mark

On 16 Apr 2016, at 16:43, Brendan Zabarauskas [email protected] wrote:

Currently cgmath only uses column vectors and column-major matrices by convention. Perhaps it would be useful to explore whether we can find a design that enforces the orientation of vectors and matrix ordering at the type level. Then perhaps we could have two separate modules with specific aliases for exporting type aliases for either column or row-major types as VectorNs and MatrixNs.

Not sure if the complexity is worth it though. I also wonder how useful it really would be for library authors.

cc. @mhintz

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

mhintz avatar Apr 16 '16 14:04 mhintz