Add Hermitian smoothing

This commit is contained in:
max.nuding 2022-07-06 13:30:05 +02:00
parent 9564ee92b6
commit d10292622a
Failed to extract signature

View File

@ -26,16 +26,12 @@ impl Perlin {
}
pub fn noise(&self, point: &Point3) -> f64 {
/*
let i = ((4.0 * point.x()) as i32) & 255;
let j = ((4.0 * point.y()) as i32) & 255;
let k= ((4.0 * point.z()) as i32) & 255;
let idx = self.perm_x[i as usize] ^ self.perm_y[j as usize] ^ self.perm_z[k as usize];
self.ranfloat[idx]
*/
let u = point.x() - point.x().floor();
let v = point.y() - point.y().floor();
let w = point.z() - point.z().floor();
let u = u * u * (3.0 - 2.0 * u);
let v = v * v * (3.0 - 2.0 * v);
let w = w * w * (3.0 - 2.0 * w);
let i = point.x().floor() as i32;
let j = point.y().floor() as i32;
let k = point.z().floor() as i32;