Advertisement

Math is like a box o' chocalates...

Started by January 02, 2002 12:39 AM
11 comments, last by Some Guy 23 years, 1 month ago
quote:
Original post by UnshavenBastard

quote: " I've seen that before. I always thought it was silly though, because is sqrt(x^2 + y^2 +
z^2) not equal to (|x| + |y| + |z|)? "

Nope.
Your x,y,z are real numbers here, where || means "absolute value", in other words
"without sign".

The eq. sqrt(x^2 + y^2 + z^2) is just pythagoras, and sqares are not done by
not caring about the sign, of course :-)
(well, of course, after squaring, you'll have no sign, though)

With vectors, || means "magnitude". So |vector| = sqrt(vx^2 + vy^2 + vz^2).





Huh.

I would have said, "(x + y + z)" instead of "(|x| + |y| + |z|)," but suppose x is negative. Then x * x would equal a positive number, and sqrt(x * x) would equal either x, being a negative, or -x, being a positive (remember that multiplying a number by -1 changes its sign). For this reason, I decided to use the absolute values of x, y, and z, but now I know that || can also mean the magnitude of a vector.



Edited by - Some Guy on January 3, 2002 2:35:16 PM
If you''re specifically interested in math as it applies to game programming, you may want to check out the math course at http://www.gameinstitute.com. I haven''t taken the math course, but I''m currently enrolled in a couple of their other courses, and they''re quite good (the BSP/PVS course is especially excellent).
Advertisement
remember,

sqrt( x ) + sqrt( y ) is not necessarily equal to sqrt( x + y ), because exponents are not distributive.
-- Succinct(Don't listen to me)

This topic is closed to new replies.

Advertisement