# Essential Math WeblogThoughts on math for games

## 5/4/2004

### Correction: Quaternions

Filed under: Erratical,Mathematical — Jim @ 9:35 pm

Ah, our first errata. How bittersweet.

Eric Mumau sent me this one. On page 499, equation 10.11 is wrong. It should read:

$(2w^2-1)\mathbf{p}+2(\mathbf{v} \bullet \mathbf{p})\mathbf{v} + 2w(\mathbf{v} \times \mathbf{p})$

Correspondingly, the following equation should read:

$R_\mathbf{q}(\mathbf{p}) = (2 \cos^2 (\theta/2)-1)\mathbf{p} + 2(\hat{\mathbf{r}}\sin(\theta/2)\bullet\mathbf{p})\hat{\mathbf{r}}\sin(\theta/2) + 2\cos(\theta/2)(\hat{\mathbf{r}}\sin(\theta/2)\times\mathbf{p})$

The rest of the page follows as before.

This affects the code which starts at the bottom of page 499. At the top of 500, the first three lines should be rewritten as:
[cpp]
float vMult = 2.0f*(x*vector.x + y*vector.y + z*vector.z);
float crossMult = 2.0f*w;
float pMult = crossMult*w – 1.0f;
[/cpp]
Note that the code on the CD is not the same as that given in the text, and in fact will actually work. However, it is slightly less efficient than what is given here.

No comments yet.

## Leave a comment

Powered by WordPress