On page 413 of the 3rd edition, you have code to demonstrate a unit vector.
Vec3 unit = v / length;
but when you go to print out the values, you reference the original x instead of the new unit which is what I think you meant to do.
cout "Unit vector: X=" << v.x << ...
should be
cout "Unit vector: X=" << unit.x << ...
Fortunately, not everyone fell asleep reading that chapter
Vec3 unit = v / length;
but when you go to print out the values, you reference the original x instead of the new unit which is what I think you meant to do.
cout "Unit vector: X=" << v.x << ...
should be
cout "Unit vector: X=" << unit.x << ...
Fortunately, not everyone fell asleep reading that chapter
The post was edited 1 time, last by grchadbourne ().