RayTracing / raytracing.github.io

Main Web Site (Online Books)
https://raytracing.github.io/
Creative Commons Zero v1.0 Universal
8.72k stars 856 forks source link

Book 2: improve center_vec name #1621

Closed whydoubt closed 1 month ago

whydoubt commented 1 month ago

As we know, naming variables is one of the hardest things...

In listing 2.3, center_vec is used to indicate the change in position over an interval of time. I don't feel the name conveys that well. Also, there is a well-established name for that concept: velocity. So I would propose velocity as a replacement. Note that this would also need to be changed in listings 2.10 and 2.11.

Also in listing 2.11... Some underscores appeared where they weren't before: center_vec = _center2 - _center1; Looks like it may have been a leftover from an earlier revision of the book.

whydoubt commented 1 month ago

A step further could be to pass velocity instead of center2... cutting out the intermediary. I haven't yet checked if that would complicate anything further down in the text though. I could put together a PR to this effect if the idea seems good.

whydoubt commented 1 month ago

If you only want to consider the change in position, without the hard implication that velocity is constant, displacement could be another alternative for center_vec.