Dot product on Vec2s returning incorrect results
The dot product seems to be returning incorrect results for the case below (using Vec2s), and I'm not sure if it's a bug or I'm using it incorrectly:
Vec2s a(-495, 584), b(101, 8);
auto c = a.dot(b);
cout << c << "\n";
cout << a[0]*b[0] + a[1]*b[1];
In the output below, the first result is clearly incorrect:
20213
-45323
The problem is probably that a short can only handle values from -32768 to 32768 so the multiplication overflows, but in the other case the compiler can magically save it... Try using ints instead of shorts in your vectors.