M
Mirco Wahab
Hi,
after working with some more algebra and a
homebrewn overloaded (lightweight) vector/matrix
class, I'm somehow weary of writing V.length() all
the time ;-)
After looking through available operators,
the only feasible operator would be the '~',
for the vector length, therefore having code
like this:
...
double cos_a = ( (C-A) * (B-A) ) // V * W => some dot product
/ ( ~(C-A) * ~(B-A) ); // ~V => vector scalar length
...
which looks "almost" idiomatic.
Any other ideas? Are there potential
precedence traps to be expected?
Or should I better stick with
...
/ ( (C-A).length() * (B-A).length() )
...
Thanks & Regards
Mirco
after working with some more algebra and a
homebrewn overloaded (lightweight) vector/matrix
class, I'm somehow weary of writing V.length() all
the time ;-)
After looking through available operators,
the only feasible operator would be the '~',
for the vector length, therefore having code
like this:
...
double cos_a = ( (C-A) * (B-A) ) // V * W => some dot product
/ ( ~(C-A) * ~(B-A) ); // ~V => vector scalar length
...
which looks "almost" idiomatic.
Any other ideas? Are there potential
precedence traps to be expected?
Or should I better stick with
...
/ ( (C-A).length() * (B-A).length() )
...
Thanks & Regards
Mirco