nature-of-code / The-Nature-of-Code-archive

The very first build system for The Nature of Code

Home Page:http://natureofcode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unnecessary step in Example 6.7

RectangleWorld opened this issue · comments

Just started reading this book online and it's great! I'll be ordering a print version ASAP.

In example 6.7, there seems to be one unnecessary step (unless I'm missing something):

sum.div(count);
sum.normalize();

Since the vector is being normalized anyway, first dividing by count will have no effect.

Ok, I simplified the examples and added a sentence: "(In fact, we don't have to divide by count anymore since we are manually setting the magnitude.)" I also changed the code to use setMag()