1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
dotSCAD/docs/lib3x-nz_perlin2.md

38 lines
762 B
Markdown
Raw Normal View History

2020-04-06 09:21:53 +08:00
# nz_perlin2
Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value at the (x, y) coordinate.
**Since:** 2.3
## Parameters
- `x` : The x coordinate.
- `y` : The y coordinate.
- `seed` : The random seed.
## Examples
use <util/rand.scad>;
2021-12-04 10:57:29 +08:00
use <polyline_join.scad>;
2021-07-03 11:53:58 +08:00
use <surface/sf_thicken.scad>;
2020-04-06 09:21:53 +08:00
use <noise/nz_perlin2.scad>;
use <contours.scad>;
seed = rand(0, 255);
points = [
for(y = [0:.1:10])
[
for(x = [0:.1:10])
[x, y, nz_perlin2(x, y, seed)]
]
];
2021-07-03 11:53:58 +08:00
sf_thicken(points, .1);
2020-04-06 09:21:53 +08:00
translate([11, 0])
for(isoline = contours(points, 0)) {
2021-12-04 10:57:29 +08:00
polyline_join(isoline)
circle(.05);
2021-07-03 11:53:58 +08:00
}
2020-04-06 09:21:53 +08:00
2021-02-24 21:09:54 +08:00
![nz_perlin2](images/lib3x-nz_perlin2-1.JPG)