mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-18 20:41:18 +02:00
add docs
This commit is contained in:
BIN
docs/images/lib2x-nz_perlin2-1.JPG
Normal file
BIN
docs/images/lib2x-nz_perlin2-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 85 KiB |
BIN
docs/images/lib2x-nz_perlin2s-1.JPG
Normal file
BIN
docs/images/lib2x-nz_perlin2s-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
37
docs/lib2x-nz_perlin2.md
Normal file
37
docs/lib2x-nz_perlin2.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# 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>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <function_grapher.scad>;
|
||||
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)]
|
||||
]
|
||||
];
|
||||
|
||||
function_grapher(points, 1);
|
||||
|
||||
translate([11, 0])
|
||||
for(isoline = contours(points, 0)) {
|
||||
hull_polyline2d(isoline, width = .1);
|
||||
}
|
||||
|
||||

|
32
docs/lib2x-nz_perlin2s.md
Normal file
32
docs/lib2x-nz_perlin2s.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# nz_perlin2s
|
||||
|
||||
Returns 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) values at (x, y) coordinates.
|
||||
|
||||
**Since:** 2.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of `[x, y]` coordinates.
|
||||
- `seed` : The random seed. If it's ignored, a randomized value will be used.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/rand.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <function_grapher.scad>;
|
||||
use <noise/nz_perlin2s.scad>;
|
||||
use <contours.scad>;
|
||||
|
||||
seed = rand(0, 255);
|
||||
|
||||
for(y = [0:.1:10]) {
|
||||
points = [for(x = [0:.1:10]) [x, y]];
|
||||
noises = nz_perlin2s(points, seed);
|
||||
for(i = [0:len(points) - 1]) {
|
||||
translate(points[i])
|
||||
linear_extrude(noises[i] + 1)
|
||||
square(.1);
|
||||
}
|
||||
}
|
||||
|
||||

|
Reference in New Issue
Block a user