Hi,
I am having problems simply normalizing a vector. Here is the code :
int diffX, diffY;
diffX = 300;
diffY = 300;
ofVec2f dirVec = (diffX, diffY);
dirVec.normalize();
cout << "dirVec x and y : " << dirVec.x << " " << dirVec.y << "\n";
I would expect dirVec to be equal to (root(2), root(2)).
Instead I get (-1, 0).
What did I do wrong ?
Bonus question : does the normalize() function cost much ? (ie, does it use the very costly square root calculation, or something faster ?)