|
From: Braden M. <br...@en...> - 2001-10-10 19:21:39
|
[Starting a new thread since this has nothing to do with Peter Meier's
problem.]
On Tue, 2001-10-09 at 16:47, S.K.Bose wrote:
> In the process of adding VrmlMatrix class (having 4X4 elements in
> row-major order), I had some discussion with Braden about interface
> issues. I am having opinion to have overloading operators "*" and "*=" to
> do multiplication of two matrices. I know multiplication of two matrices
> is not commutative (A*B != B*A). But if I write "A*B" --- it means I want
> to do multiplication from "left to right" (B is post multiplied with A)
> not from "right to left". Is there any scope of ambiguity exist by having
> such operators in VrmlMatrix class?
In general, class interfaces should not provide multiple means of doing
the exact same thing. The methods MMleft() and MMright() provide the
necessary functionality; and I prefer this approach as it is consistent
with the ECMAScript VrmlMatrix definition. (In general, I think we
should match method names with the ECMAScript definition, where our
VrmlMatrix does the same thing.)
Some other issues:
* The constructor that takes a float[4][4] should be made
explicit. I don't think automatic conversions from that type
are desirable.
* By the same token, I think the cast operators to float* and
Matrix& should be dropped. Someone who wants a pointer to the
first element can get it easily enough using
float * f = &myVrmlMatrix[0];
* operator[] should return a float (&)[4]. This maintains static
type checking of the array size.
* Rather than have the static method identity(), why not just
have the default constructor create an identity matrix?
--
Braden McDaniel e-mail: <br...@en...>
<http://endoframe.com> Jabber: <br...@ja...>
|