1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-18 06:38:14 +01:00

accept x,, y directly

This commit is contained in:
Justin Lin 2020-03-09 08:38:48 +08:00
parent a790409292
commit 7298067343
2 changed files with 4 additions and 6 deletions

View File

@ -1,6 +1,6 @@
use <util/rand.scad>;
use <function_grapher.scad>;
use <experimental/pnoise2.scad>;
use <experimental/pnoise2s.scad>;
module demo1() {
points = [
@ -8,7 +8,7 @@ module demo1() {
for(x = [0:.2:10])
[x, y]
];
noise = pnoise2(points);
noise = pnoise2s(points);
for(i = [0:len(points) - 1]) {
c = (noise[i] + 1.1) / 2;
@ -32,7 +32,7 @@ module demo2() {
function_grapher(
[
for(ri = [0:len(points) - 1])
let(ns = pnoise2(points[ri], seed))
let(ns = pnoise2s(points[ri], seed))
[
for(ci = [0:len(ns) - 1])
[points[ri][ci][0], points[ri][ci][1], ns[ci]]

View File

@ -1,6 +1,4 @@
use <util/rand.scad>;
use <experimental/_impl/_pnoise2_impl.scad>;
function pnoise2(points, seed) =
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
[for(p = points) _pnoise2(p[0], p[1], sd)];
function pnoise2(x, y, seed) = _pnoise2(x, y, seed % 256);