Page 1 of 1

Math and C++ [SOLVED]

Posted: Sun Oct 27, 2013 12:59 pm
by Benjamin100
Well, I'm back after a long break from programming to get back into it again.
This time I've decided to stick to learning some more basics before trying to make any sort of complicated 3d program.

For me this means some math.
I'm using a math related book, and right now I am reading about the dot product. What is the dot product actually used for? Maybe I've used it before and I just didn't call it that. What sort of situation would require calculating the dot product?

Re: Math and C++

Posted: Sun Oct 27, 2013 1:22 pm
by qpHalcy0n
Most handily, it tells you something about the degree of "parallelity" (that word is an invention) between two vectors.

If a and b are vectors then if:

a*b = 0 , the vectors are orthogonal

if a*b = |a||b| then they are parallel and coincident in direction. If the dot product is negative but of the same magnitude, they are parallel and 180 degrees separated. If they are unit vectors (length of 1), then this product will be 1 or -1.

a*b = |a||b|cos(angle-btw-a-and-b)

Used in projections. IE: projecting a vector onto an arbitrary plane or line. Vector-resolution.

Used all over linear algebra in Gram-Schmidt, least squares, SVD, and all sorts of compression algorithms. Critical to understanding any form of data compression or reconstruction.

Re: Math and C++

Posted: Sun Oct 27, 2013 5:38 pm
by Benjamin100
Thanks.
I guess I'll just have to wait until a time when it clearly needs to be used.
I like getting back to programming. Making some math functions now.