C# Eratta
========================================================================
Chapter 1, Page 5

private PicSourcePaint...
should say
private void PicSourcePaint...
========================================================================
Chapter 1: Page 6

Graphics graph = new Graphics();
This line isn't legal code. The correct code is
Graphics graph;
And the Graphics object must be obtained from a preexisting context.
Also, this line:
graphics = Graphics.FromHwnd(picSource.Handle);
should be
graphics = Graphics.FromImage(picSource.Image);
(also note that .Image is capitalized, unlike the code sample in the
middle of page 6)
========================================================================
Chapter 1, Page 7

linGrBrush = new Drawing2D.LinearGradientBrush(...)
is missing a semicolon. The last line should say
Color.FromArgb(255, 0, 0, 255)); //Blue
========================================================================
Chapter 1, Page 8

brushSquare.SurroundColors = new Color(){Color.FromArgb(255,0,0,255)};
should be
brushSquare.SurroundColors = new Color[]{Color.FromArgb(255,0,0,255)};
And...
Graph.FillPath(brushSquare, graphPath);
should be
graph.FillPath(brushSquare, graphPath);
========================================================================
Chapter 1, Page 10

if(Dx > (r1.extentX+r2.extentX) && (Dy > (r1.extentY+r2.extentY))...
should be
if((Dx < (r1.extentX+r2.extentX)) && (Dy < (r1.extentY+r2.extentY))
//overlap
else
//no overlap
========================================================================
Chapter 1, Page 16

Some readers have indicated that the Implementation of CircleIntersect at the bottom of Page 18 is erroneous,
indicating that the call to Math.Sqr (squaring function) should be Math.Sqrt (Square root). This is not an error.
Kind of. The error is that we should have used Math.Pow. Math.Sqr isn't a valid function. In addition, the return
result:
return (Radius*Radius) < dist;
should be
return dist < (Radius*Radius);
In order to simplify understanding this collision test, I've added a class and an Nunit test harness to help.
The class is AxisAlignedBoundingBox and the test is AABBTest. Please refer to this code instead of the code
snippets on page 16.
========================================================================
Chapter 1, Page 19

Figure 1-17 says
Dividing a screen into 64 zones
should say
Dividing a screen into 256 zones
========================================================================
Chapter 1, Page 22

The extension to Arvo's algorithm on this page is incorrect. Adding a Z axis
check to the AxisAlignedBoundingBox and test code (mentioned above) will yield
correct results.
========================================================================
Chapter 1, Page 34

square.Draw(picBackground.Handle);
should be
square.Show(picBackground.Handle);
========================================================================
Chapter 1, Page 35

square.Draw(picBackground.Handle);
should be
square.Show(picBackground.Handle);
========================================================================
Chapter 1, Page 38

case BlockTypes.Square:
square1.Location = new Point(Location.X, Location.Y);
square2.Location = new Point(Location.X+squareSize, Location.Y);
square3.Location = new Point(Location.X, Location.Y+squareSize);
square4.Location = new Point(Location.X+squareSize, Location.Y+squareSize);
break;
should be
case BlockTypes.Square:
square1.Location = new Point(location.X, location.Y);
square2.Location = new Point(location.X+squareSize, location.Y);
square3.Location = new Point(location.X, location.Y+squareSize);
square4.Location = new Point(location.X+squareSize, location.Y+squareSize);
break;
========================================================================
Chapter 1,Pages 39-42

squareN.location
should be
squareN.Location
========================================================================
Chapter 1, page 49

private void CmdStart_Click event handler must have this value set somewhere
in the method:
CmdStart.Enabled = false;
========================================================================
Chapter 6, pg 294

The new SDK simply returns an identical reference to a mesh if you call Mesh.Clean and nothing changes,
so these lines of code:
tempMesh = Mesh.Clean(CleanType.Optimization, systemMemoryMesh, adjacencyBuffer, adjacencyBuffer, out errorString);
systemMemoryMesh.Dispose();
systemMemoryMesh = tempMesh;
Will yield a nulled SystemMemoryMesh if Mesh.Clean does nothing. You must explicitly check to verify that the meshes
are identical by using the Equals method:
tempMesh = Mesh.Clean(CleanType.Optimization, systemMemoryMesh, adjacencyBuffer, adjacencyBuffer, out errorString);
if (tempMesh != systemMemoryMesh) {
systemMemoryMesh.Dispose();
systemMemoryMesh = tempMesh;
}
========================================================================
Chapter 6, pg 295

The Managed DirectX mesh flag OptimizeAttrSort has been changed to OptimizeAttributeSort to conform to Microsoft
coding standards.
========================================================================
Chapter 6/7

The shell code for the Spacewar3D game used the PureDevice flag when creating the device caps. This resulted in
very strange side-effects or non-functional programs. That flag has been terminated with prejudice.