The Ray Tracer Challenge: Rational Form inverses (pg 39-41)

Whilst the author has been careful to provide exact results for the tests elsewhere in the book (such as surds with the transformation tests), and indirectly provided them for the first of the tests, the second and third inverse tests are missing rational form expected results.

These can be trivially produced using Wolfram Alpha, but for the two tests on page 41:

For A = 
|  8 -5  9  2 |
|  7  5  6  1 |
| -6  0  9  6 |
| -3  0 -9 -4 |

The rational-form inverse is:

| -30  -30  -55 -105 |
| -15   24    5    6 |
|  70   70   85  180 | * 1/195
| 135 -135 -150 -375 |


For A = 
|  9  3  0  9 |
| -5 -2 -6 -3 |
| -4  9  6  4 |
| -7  6  6  2 |

The rational-form inverse is:
|  -66 -126  234 -360 |
| -126   54  594 -540 |
|  -47 -237 -177  210 | *  1/1620;
|  288  108 -432  540 |

Using the above you can match the tests to whatever final precision your code is operating in.

3 Likes