Skip to content

Commit 666a43d

Browse files
committed
Fix typo
1 parent 9cda50b commit 666a43d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/RayTracingInOneWeekend.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Fast = false
99
const F = Float32
1010
const N = 8 # vector width
1111

12-
const Point = SVector{3, F} # We use F so we dont have points of different types, otherwise Ray, Sphere become parametric types and HittableList needs to be contructed carefully to ensure same types everywhere. (can we somehow promote it)
12+
const Point = SVector{3, F} # We use F so we dont have points of different types, otherwise Ray, Sphere become parametric types and HittableList needs to be constructed carefully to ensure same types everywhere. (can we somehow promote it)
1313
const Spectrum = SVector{3, F}
1414

1515
@with_kw struct Ray @deftype Point
@@ -87,7 +87,7 @@ function Camera(nx::Integer=400, ny=imagesize(nx, 16/9)[2], pinhole_location=Poi
8787
u = normalize(w × up)
8888
v = w × u
8989

90-
right = u * camera_width / nx
90+
right = u * camera_width / nx
9191
down = v * camera_height / ny
9292

9393
camera_centre = pinhole_location + w * focus_distance
@@ -106,7 +106,7 @@ end
106106

107107
function world_color(ray)
108108
interp = (ray.direction.z + 1) / 2
109-
return (1 - interp) * Spectrum(1, 1, 1) + interp * Spectrum(0.5, 0.7, 1.0) # Spectrum{3, Float64} instead of Spectrum{3, F} saves 1mb, 0.2s for nx=50.
109+
return (1 - interp) * Spectrum(1, 1, 1) + interp * Spectrum(0.5, 0.7, 1.0) # Spectrum{3, Float64} instead of Spectrum{3, F} saves 1mb, 0.2s for nx=50.
110110
end
111111

112112
@static if Fast
@@ -178,7 +178,7 @@ end
178178

179179
sinθ = sqrt(max(1 - cosθ^2, zero(F)))
180180
@smart_assert !isnan(sinθ)
181-
181+
182182
if into
183183
ior_ratio = air_ior / ior
184184
else
@@ -198,14 +198,14 @@ end
198198
end
199199
end
200200

201-
@fastmath function lambertian(ray, n⃗)
201+
@fastmath function lambertian(ray, n⃗)
202202
random = random_on_unit_sphere_surface()
203203
vector = n⃗ + random
204204

205205
if all(vector .≈ 0)
206206
vector = n⃗
207207
end
208-
208+
209209
direction = normalize_fast(vector)
210210
return direction
211211
end
@@ -239,7 +239,7 @@ end
239239
%3 = sext <$N x i1> %2 to <$N x $t>
240240
ret <$N x $t> %3
241241
"""
242-
return :(
242+
return :(
243243
$(Expr(:meta,:inline));
244244
Vec(Base.llvmcall($s, SIMD.LVec{$N,$F}, Tuple{SIMD.LVec{$N,Bool}}, x.data))
245245
)
@@ -262,19 +262,19 @@ const initialRecord = hit_record(zeros(Point), normalize(ones(Point)), Sphere().
262262
coy = hittable_list.spheres.centre.y[lane] - r.origin.y
263263
coz = hittable_list.spheres.centre.z[lane] - r.origin.z
264264

265-
neg_half_b = r.direction.x * cox + r.direction.y * coy
265+
neg_half_b = r.direction.x * cox + r.direction.y * coy
266266
neg_half_b += r.direction.z * coz
267267

268-
c = cox*cox + coy*coy
269-
c += coz*coz
268+
c = cox*cox + coy*coy
269+
c += coz*coz
270270
c -= hittable_list.spheres.radius[lane] * hittable_list.spheres.radius[lane]
271271

272272
quarter_discriminant = neg_half_b^2 - c
273273
isDiscriminantPositive = quarter_discriminant > 0
274274

275275
if any(isDiscriminantPositive)
276276
@fastmath sqrtd = sqrt(quarter_discriminant) # When using fastmath, negative values just give 0
277-
277+
278278
root = neg_half_b - sqrtd
279279
root2 = neg_half_b + sqrtd
280280

@@ -298,7 +298,7 @@ const initialRecord = hit_record(zeros(Point), normalize(ones(Point)), Sphere().
298298
normal = sphere_normal(sphere, position)
299299

300300
return hit_record(position, normal, sphere.material, minHitT)
301-
else
301+
else
302302
return initialRecord
303303
end
304304
end
@@ -338,8 +338,8 @@ function scene_random_spheres()
338338
center = [a + 0.9*rand(), -(b + 0.9*rand()), 0.2]
339339

340340
# skip spheres too close?
341-
if norm(center - SA[4,0, 0.2]) < 0.9 continue end
342-
341+
if norm(center - SA[4,0, 0.2]) < 0.9 continue end
342+
343343
if choose_mat < 4//5
344344
# lambertian
345345
albedo = rand(Spectrum) .* rand(Spectrum)
@@ -443,7 +443,7 @@ end
443443

444444
# render!(spectrum_img, HittableList, camera, samples_per_pixel=10)
445445

446-
# Profile.Allocs.clear();
446+
# Profile.Allocs.clear();
447447

448448
# Profile.Allocs.@profile sample_rate=1 render!(spectrum_img, scene, camera)
449449

0 commit comments

Comments
 (0)