mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 17:24:20 +02:00
accept x,, y directly
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <function_grapher.scad>;
|
use <function_grapher.scad>;
|
||||||
use <experimental/pnoise2.scad>;
|
use <experimental/pnoise2s.scad>;
|
||||||
|
|
||||||
module demo1() {
|
module demo1() {
|
||||||
points = [
|
points = [
|
||||||
@@ -8,7 +8,7 @@ module demo1() {
|
|||||||
for(x = [0:.2:10])
|
for(x = [0:.2:10])
|
||||||
[x, y]
|
[x, y]
|
||||||
];
|
];
|
||||||
noise = pnoise2(points);
|
noise = pnoise2s(points);
|
||||||
|
|
||||||
for(i = [0:len(points) - 1]) {
|
for(i = [0:len(points) - 1]) {
|
||||||
c = (noise[i] + 1.1) / 2;
|
c = (noise[i] + 1.1) / 2;
|
||||||
@@ -32,7 +32,7 @@ module demo2() {
|
|||||||
function_grapher(
|
function_grapher(
|
||||||
[
|
[
|
||||||
for(ri = [0:len(points) - 1])
|
for(ri = [0:len(points) - 1])
|
||||||
let(ns = pnoise2(points[ri], seed))
|
let(ns = pnoise2s(points[ri], seed))
|
||||||
[
|
[
|
||||||
for(ci = [0:len(ns) - 1])
|
for(ci = [0:len(ns) - 1])
|
||||||
[points[ri][ci][0], points[ri][ci][1], ns[ci]]
|
[points[ri][ci][0], points[ri][ci][1], ns[ci]]
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <experimental/_impl/_pnoise2_impl.scad>;
|
use <experimental/_impl/_pnoise2_impl.scad>;
|
||||||
|
|
||||||
function pnoise2(points, seed) =
|
function pnoise2(x, y, seed) = _pnoise2(x, y, seed % 256);
|
||||||
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
|
|
||||||
[for(p = points) _pnoise2(p[0], p[1], sd)];
|
|
Reference in New Issue
Block a user