Re: quick comments on Matrix

Sorry if I'm late to the party. If there's already a huge discussion of
this just point me to it.

But, some questions


*Why m11,m12,m13,m14  etc instead of m00, m01, m02, m03?*

If I'm doing arrays in JavaScript they start at 0. It would be nice to be
able to do this

for (var i = 0; i < 4; ++i) {
  for (var j = 0; j < 4; ++j) {
     someMatrix['m'+i+j] = someArray[i][j];
  }
}

If they start at m11 that becomes much less pleasant. Yes I know there are
constructors etc that take various types of arrays. My only point is it
seems more consistent if the indices or implied indices match.


*Why combine 2x3 and 4x4 Matrixes?*

It seems like it makes the implementation slower (have to check if I should
be doing 2x3 or 4x4 math) and while behind the scenes you could have 2
different classes that begs the question, why not just expose them
separately?


*How about lookAt, perspective, ortho and frustum?*

Those are used in nearly every 3D app.


*How about on top of transformPoint also transformDirection,
transformVector?*
*
*
All of those are useful and commonly needed.

transformPoint =  (m * p) / p.w
transformVector = (m * p)
transformDirection = (m * p) but ignores the last row of m

transformPoint and transformVector is needed as they're common for doing
mouse to 3D calculations.

*Why Point instead of Vector?*

I don't want to bikeshed here but in my limited circle a Point doesn't have
a W. A Point represents a place in 2D or 3D space. Mathematically you can't
add 2 points but you can add 2 vectors. Subtracting 2 points gives you a
vector. Adding a vector to a point transforms a point. Adding 2 vectors
gives another vector. That might just be my experience and not connected to
any reality but I've seen the distinction in libraries I've used. It's also
related the suggestion for transformPoint vs transformVector.

*How about add, subtract, scale, distance, normalize, length,
lengthSquared, dot, and cross on Point?*

Just asking. If all point is is x,y,z,w and no functionality them might as
well get rid of it and just pass Float32Array(4) everywhere.

*
*
*
*

Received on Saturday, 16 March 2013 05:58:15 UTC