quote:
Original post by synopsis
There are at least 3 vector-vector operations which could be denoted by the * operator: Multiplication of a vector by a vector (r.x = a.x * b.x); The dot product and the cross product.
The use of the ''|'' operator (binary or) as the dot product, for example, is extremely confusing for readers who don''t know the classes. (That is not some idea I just had, I really had to work with such code)
I also think that there is another point to think of: Having, for example matrix multiplication, defined as the ''*''-operator is a kind of euphemism it seems: Such a simple symbol for a comparetively complex operation?
Perhaps one could use the binary NOT for matrix inversion... Making matters worse, operators cannot always return error values, which might occur for example with matrix inversion.
Greetz,
Synopsis
I''ve never heard of a vector-vector multiplication being defined as you do (i.e. multiply the components to get the resultant vector). I don''t think it has much geometrical significance.
I do agree with your point about not defining matrix multiplication with operator overloading, for one thing, when maths people see ABC (multiply 3 matrices), it means "multiply B by C, and then multiply the result on the left by A", i.e. the operator is evaluated from right to left, like composition of functions (which is what matrices sprang out of - combs of linear funcs).
I''ll also note that the Maya API defines * for vector-vector mults as the dot product and also for the normal vector-scalar operation (for 1 vector, 1 scalar forms). It also defines ^ as the cross-product, because XORing vectors together doesn''t make much sense. Still no vector by vector division though, just vector / scalar.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley