Skip to content

Commit 504e843

Browse files
Brandon SmithBrandon Smith
Brandon Smith
authored and
Brandon Smith
committedFeb 14, 2020
Make "normal bumping" distance smaller
1 parent 62734bb commit 504e843

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎src/sphere.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ impl Sphere {
2828
}
2929
}
3030

31+
/*
32+
pub fn contains(&self, vec: &Vec3) -> bool {
33+
(vec - &self.position).len_squared() < self.radius_squared
34+
}*/
35+
3136
/*
3237
pub fn surface_point(&self, latitude: f32, longitude: f32) -> Vec3 {
3338
let lat_cos = latitude.cos();
@@ -81,7 +86,7 @@ impl Object for Sphere {
8186

8287
return Some(Intersection::new(
8388
distance,
84-
&position + &(&normal * 0.01), // offset to avoid floating-point error
89+
&position + &(&normal * 0.001), // offset to avoid floating-point error
8590
normal,
8691
direction,
8792
));

‎src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn plane_intersection(position: &Vec3, normal: &Vec3, ray: &Ray) -> Option<I
3535

3636
return Some(Intersection::new(
3737
distance,
38-
&point + &(normal * 0.01), // offset to avoid floating-point error
38+
&point + &(normal * 0.001), // offset to avoid floating-point error
3939
*normal,
4040
ray.direction,
4141
));

0 commit comments

Comments
 (0)