# The Ray Tracer Challenge: "Computing the normal on a transformed sphere" ebook test

**URL:** <https://forum.devtalk.com/t/the-ray-tracer-challenge-computing-the-normal-on-a-transformed-sphere-ebook-test/5831>\
**Category:** PragProg Customers\
**Tags:** book-the-ray-tracer-challenge, errata\
**Created:** [10 January 2021 18:18 UTC](https://forum.devtalk.com/t/the-ray-tracer-challenge-computing-the-normal-on-a-transformed-sphere-ebook-test/5831 "2021-01-10T18:18:38Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![mx00s](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mx00s/32/6921_2.png) [@mx00s](https://forum.devtalk.com/u/mx00s)\
**Post date:** [13 January 2025 01:25 UTC](https://forum.devtalk.com/t/the-ray-tracer-challenge-computing-the-normal-on-a-transformed-sphere-ebook-test/5831/7 "2025-01-13T01:25:55Z")

</div>

@jamis

I ran into this too. I’m also using a fluent interface and transcribed the test wrong. Thank you both for helping me understand what’s going wrong.

It’s a bit odd that the rotation is even part of the transformation since it’s clearly a no-op when applied to the unit sphere centered on the object origin. After fixing my test transcription bug, I came up with an alternative test where each part of the transform has a meaningful impact:

```auto
Scenario: Given the normal on a transformed sphere
Given s <- sphere()
And m <- scaling(1, 0.5, 1) * shearing(1, 0, 0, 0, 0, 0)
And set_transform(s, m)
When n <- normal_at(s, point(0, sqrt(2)/2, sqrt(2)/2))
Then n = vector(-0.24077171, 0.96308684, -0.120385855)

```

But beware, I have _not_ verified the computation beyond using my implementation to get the normal vector. Also, note if you’re using a fluent interface for your transforms, the identity should be followed by shearing.

---

_[View the full topic](https://forum.devtalk.com/t/the-ray-tracer-challenge-computing-the-normal-on-a-transformed-sphere-ebook-test/5831)._
