I'm working with vectors (not the STL vector), and I'm trying to get the angle between two vectors. I've created a function that returns the result of a dot operation (·) (Which is required). Strangely enough, when I call std::acos( ), I get the IND output (I believe that it's a result of diving by zero). Here's my function:
Thanks for the reply, CreativeMFS. That explains why I get the IND result. One more thing, though: When I normalize my vector, my vector doesn't equal the value of 1. All of the websites say that the vector should equal to one after normalization. Any thoughts on this?
To normalize, you basically divide each dimension (or coordinate or whatever you call it) by the vector's magnitude. If that doesn't yield a normalized vector, remember that PC's have rounding issues. Personally, I would work with doubles by default.
this is only the dot product... the angle is something like this
cos(∂)=A.B/|A||B|...
A.B is dot product....
|A||B| is the product of their magnitudes.....