Skip to content

Commit 9bd2580

Browse files
committed
Correct geometry from vec3 to point3 final scene
Book 1, we were computing the length of a point - vector, but that doesn't make sense; it should have been computing the length of the point - point. Resolves #609
1 parent 40f13bb commit 9bd2580

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ Change Log -- Ray Tracing in One Weekend
33

44
# v3.1.2 (in progress)
55

6+
### _In One Weekend_
7+
- Fix: Corrected geometry type when computing distance between two points, final scene (#609)
8+
69
### _The Rest of Your Life_
7-
- Fix: missing closing parenthesis in listing 10 (#603)
10+
- Fix: Missing closing parenthesis in listing 10 (#603)
811

912

1013
----------------------------------------------------------------------------------------------------

books/RayTracingInOneWeekend.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2889,7 +2889,7 @@
28892889
auto choose_mat = random_double();
28902890
point3 center(a + 0.9*random_double(), 0.2, b + 0.9*random_double());
28912891

2892-
if ((center - vec3(4, 0.2, 0)).length() > 0.9) {
2892+
if ((center - point3(4, 0.2, 0)).length() > 0.9) {
28932893
shared_ptr<material> sphere_material;
28942894

28952895
if (choose_mat < 0.8) {

src/InOneWeekend/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ hittable_list random_scene() {
5252
auto choose_mat = random_double();
5353
point3 center(a + 0.9*random_double(), 0.2, b + 0.9*random_double());
5454

55-
if ((center - vec3(4, 0.2, 0)).length() > 0.9) {
55+
if ((center - point3(4, 0.2, 0)).length() > 0.9) {
5656
shared_ptr<material> sphere_material;
5757

5858
if (choose_mat < 0.8) {

0 commit comments

Comments
 (0)