Skip to content

Commit b82be4d

Browse files
authored
Merge branch 'dev-patch' into fix-bib
2 parents c321e32 + b8a5fad commit b82be4d

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Change Log -- Ray Tracing in One Weekend
1010
- Fix: Undefined `vup` variable in camera definition (#686)
1111
- Fix: Listing 51: Add missing `hittable.h`, `rtweekend.h` includes (#693)
1212
- Fix: Fix error in citation section (#721)
13+
- Fix: Listings 33, 39: Add consistent function signature for `trilinear_interp` (#722)
1314

1415
### _The Next Week_
1516
- Delete: Remove unused u,v,w variables in initial `perlin::noise()` function (#684)

books/RayTracingTheNextWeek.html

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,21 +1568,6 @@
15681568

15691569
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
15701570

1571-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1572-
inline double trilinear_interp(double c[2][2][2], double u, double v, double w) {
1573-
auto accum = 0.0;
1574-
for (int i=0; i < 2; i++)
1575-
for (int j=0; j < 2; j++)
1576-
for (int k=0; k < 2; k++)
1577-
accum += (i*u + (1-i)*(1-u))*
1578-
(j*v + (1-j)*(1-v))*
1579-
(k*w + (1-k)*(1-w))*c[i][j][k];
1580-
1581-
return accum;
1582-
}
1583-
1584-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1585-
15861571
class perlin {
15871572
public:
15881573
...
@@ -1610,6 +1595,21 @@
16101595
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
16111596
}
16121597
...
1598+
private:
1599+
...
1600+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
1601+
static double trilinear_interp(double c[2][2][2], double u, double v, double w) {
1602+
auto accum = 0.0;
1603+
for (int i=0; i < 2; i++)
1604+
for (int j=0; j < 2; j++)
1605+
for (int k=0; k < 2; k++)
1606+
accum += (i*u + (1-i)*(1-u))*
1607+
(j*v + (1-j)*(1-v))*
1608+
(k*w + (1-k)*(1-w))*c[i][j][k];
1609+
1610+
return accum;
1611+
}
1612+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
16131613
}
16141614
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16151615
[Listing [perlin-trilinear]: <kbd>[perlin.h]</kbd> Perlin with trilienear interpolation]
@@ -1818,12 +1818,13 @@
18181818
...
18191819
private:
18201820
...
1821-
inline double perlin_interp(vec3 c[2][2][2], double u, double v, double w) const {
1821+
static double perlin_interp(vec3 c[2][2][2], double u, double v, double w) {
1822+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
18221823
auto uu = u*u*(3-2*u);
18231824
auto vv = v*v*(3-2*v);
18241825
auto ww = w*w*(3-2*w);
18251826
auto accum = 0.0;
1826-
1827+
18271828
for (int i=0; i < 2; i++)
18281829
for (int j=0; j < 2; j++)
18291830
for (int k=0; k < 2; k++) {
@@ -1833,10 +1834,11 @@
18331834
* (k*ww + (1-k)*(1-ww))
18341835
* dot(c[i][j][k], weight_v);
18351836
}
1836-
1837+
18371838
return accum;
1839+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
18381840
}
1839-
...
1841+
...
18401842
}
18411843
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18421844
[Listing [perlin-interp]: <kbd>[perlin.h]</kbd> Perlin interpolation function so far]

src/common/perlin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class perlin {
9797
}
9898
}
9999

100-
inline static double perlin_interp(vec3 c[2][2][2], double u, double v, double w) {
100+
static double perlin_interp(vec3 c[2][2][2], double u, double v, double w) {
101101
auto uu = u*u*(3-2*u);
102102
auto vv = v*v*(3-2*v);
103103
auto ww = w*w*(3-2*w);

0 commit comments

Comments
 (0)