1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

add pnoise1

This commit is contained in:
Justin Lin
2020-03-05 17:59:02 +08:00
parent ec9fbc6162
commit f1d864e44a

View File

@@ -0,0 +1,10 @@
function _pnoise1(x, n, slopes) =
let(
lo = floor(x),
hi = (lo + 1) % n,
dist = x - lo,
loPos = slopes[lo] * dist,
hiPos = -slopes[hi] * (1 - dist),
u = pow(dist, 3) * (dist * (dist * 6 - 15) + 10)
)
loPos * (1 - u) + hiPos * u;