64kramsystem

64kramsystem

The Ray Tracer Challenger: unnecessary normalization (page 73)

In the last hint (#4) of Chapter 5, the pseudocode applies a normalization to the origin ray:

  • r ← ray(ray_origin, normalize(position - ray_origin))

normalizing in this case unnecessary, since with or without, the intersections detected are going to be the same.

My supposition is that this it was an accidental addition, or that it’s a common practice, so it’s been added even if it’s not necessary.

I think it should be either removed, or, if the case is the second, some explanation should be given, in particular, because at this stage of the book, it’s not entirely clear when normalization should be performed (there is only a generic explanation at page 30), so I find it (at least, personally) confusing.

First Post!

jamis

jamis

Author of Mazes for Programmers and 1 other title

You’re right that I should explained that better. As it is: yes, you’ll detect an intersection whether the ray is normalized or not, but the distance to that intersection will differ depending on whether or not the ray is normalized. For this example, the distance doesn’t matter, just the fact of an intersection is sufficient.

So, yeah, maybe I could have left that off here. But the thinking was that for the next chapter, it would carry over. (See step #3 of “Putting It Together” in Chapter 6.)

Popular Prag Prog topics Top

johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
New
Chrichton
Dear Sophie. I tried to do the “Authorization” exercise and have two questions: When trying to plug in an email-service, I found the ...
New
Charles
In general, the book isn’t yet updated for Phoenix version 1.6. On page 18 of the book, the authors indicate that an auto generated of ro...
New
brunogirin
When installing Cards as an editable package, I get the following error: ERROR: File “setup.py” not found. Directory cannot be installe...
New
New
dsmith42
Hey there, I’m enjoying this book and have learned a few things alredayd. However, in Chapter 4 I believe we are meant to see the “>...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
foxtrottwist
Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New
DevotionGeo
The V Programming Language Simple language for building maintainable programs V is already mentioned couple of times in the forum, but I...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New

Latest in PragProg

View all threads ❯