noc-book-2
noc-book-2 copied to clipboard
The drawCircle parameter named "radius" is actually the diameter (section 8.2)
In section 8.2, Recursion, the three examples contain a drawCircle function to demonstrate recursion. The last parameter to this function is named "radius", but it is passed to ellipse() as the width parameter, which is actually the diameter. It works fine since JavaScript doesn't care what names you give your variables, but calling the diameter "radius" may be confusing for humans trying to understand the code!
Section 9.13 has a similar issue. The text says "The creature will have a radius" and the code has a variable "r", but "r" is the diameter, not the radius.
This has been fixed in chapter 8, removing the label but leaving open for when I get to chapter 9.
chapter 9 draws the floops with this.r * 2 now!