mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
add docs
This commit is contained in:
parent
cc1e381fd8
commit
fa8da3d0c5
@ -198,8 +198,8 @@ See [examples](examples).
|
||||
- [noise/nz_perlin3s](https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_perlin3s.html)
|
||||
- [noise/nz_worley2](https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley2.html)
|
||||
- [noise/nz_worley2s](https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley2s.html)
|
||||
- noise/nz_worley3
|
||||
- noise/nz_worley3s
|
||||
- [noise/nz_worley3](https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley3.html)
|
||||
- [noise/nz_worley3s](https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley3s.html)
|
||||
- noise/nz_cell
|
||||
|
||||
## Bugs and Feedback
|
||||
|
BIN
docs/images/lib2x-nz_worley3-1.JPG
Normal file
BIN
docs/images/lib2x-nz_worley3-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
docs/images/lib2x-nz_worley3s-1.JPG
Normal file
BIN
docs/images/lib2x-nz_worley3s-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
docs/images/lib2x-nz_worley3s-2.JPG
Normal file
BIN
docs/images/lib2x-nz_worley3s-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
docs/images/lib2x-nz_worley3s-3.JPG
Normal file
BIN
docs/images/lib2x-nz_worley3s-3.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
39
docs/lib2x-nz_worley3.md
Normal file
39
docs/lib2x-nz_worley3.md
Normal file
@ -0,0 +1,39 @@
|
||||
# nz_worley3
|
||||
|
||||
Returns the 3D [Worley noise](https://en.wikipedia.org/wiki/Worley_noise) value `[cell_x, cell_y, cell_y, noise]` at the (x, y, z) coordinate.
|
||||
|
||||
It divides the space into grids. The nucleus of each cell is randomly placed in a grid.
|
||||
|
||||
**Since:** 2.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `x` : The x coordinate.
|
||||
- `y` : The y coordinate.
|
||||
- `z` : The z coordinate.
|
||||
- `seed` : The random seed.
|
||||
- `grid_w` : The grid width. Default to 10. Smaller `grid_w` makes more cells.
|
||||
- `dist` : The noise value of each point is based on its distance to other cells. Different distance strategies make different noises. The `dist` parameter accepts `"euclidean"`, `"manhattan"`, `"chebyshev"` or `"border"`.
|
||||
|
||||
## Examples
|
||||
|
||||
use <pixel/px_sphere.scad>;
|
||||
use <noise/nz_worley3.scad>;
|
||||
|
||||
grid_w = 10;
|
||||
dist = "border"; // [euclidean, manhattan, chebyshev, border]
|
||||
seed = 51;
|
||||
|
||||
points = px_sphere(20);
|
||||
|
||||
cells = [for(p = points) nz_worley3(p[0], p[1], p[2], seed, grid_w, dist)];
|
||||
|
||||
max_dist = max([for(c = cells) c[3]]);
|
||||
for(i = [0:len(cells) - 1]) {
|
||||
c = cells[i][3] / max_dist * 1.5;
|
||||
color([c > 1 ? 1 : c, 0, 0])
|
||||
translate(points[i])
|
||||
cube(1);
|
||||
}
|
||||
|
||||
![nz_worley3](images/lib2x-nz_worley3-1.JPG)
|
42
docs/lib2x-nz_worley3s.md
Normal file
42
docs/lib2x-nz_worley3s.md
Normal file
@ -0,0 +1,42 @@
|
||||
# nz_worley3s
|
||||
|
||||
Returns 3D [Worley noise](https://en.wikipedia.org/wiki/Worley_noise) values `[cell_x, cell_y, cell_y, noise]` at (x, y, z) coordinates.
|
||||
|
||||
It divides the space into grids. The nucleus of each cell is randomly placed in a grid.
|
||||
|
||||
**Since:** 2.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of `[x, y, z]` coordinates.
|
||||
- `seed` : The random seed.
|
||||
- `grid_w` : The grid width. Default to 10. Smaller `grid_w` makes more cells.
|
||||
- `dist` : The noise value of each point is based on its distance to other cells. Different distance strategies make different noises. The `dist` parameter accepts `"euclidean"`, `"manhattan"`, `"chebyshev"` or `"border"`.
|
||||
|
||||
## Examples
|
||||
|
||||
use <pixel/px_sphere.scad>;
|
||||
use <noise/nz_worley3s.scad>;
|
||||
|
||||
tile_w = 10;
|
||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||
seed = 51;
|
||||
|
||||
points = px_sphere(20);
|
||||
cells = nz_worley3s(points, seed, tile_w, dist);
|
||||
|
||||
for(i = [0:len(cells) - 1]) {
|
||||
c = (norm([cells[i][0], cells[i][1], cells[i][2]]) % 20) / 20;
|
||||
color([c, c, c])
|
||||
translate(points[i])
|
||||
cube(1);
|
||||
}
|
||||
|
||||
![nz_worley3s](images/lib2x-nz_worley3s-1.JPG)
|
||||
|
||||
You can build things like [worley_noise_ball](https://github.com/JustinSDK/dotSCAD/blob/master/examples/worley_noise_ball.scad).
|
||||
|
||||
![nz_worley3s](images/lib2x-nz_worley3s-2.JPG)
|
||||
|
||||
|
||||
![nz_worley3s](images/lib2x-nz_worley3s-3.JPG)
|
@ -1,23 +0,0 @@
|
||||
use <noise/nz_worley3.scad>;
|
||||
|
||||
size = [20, 20, 20];
|
||||
tile_w = 10;
|
||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||
seed = 51;
|
||||
|
||||
points = [
|
||||
for(z = [0:size[2] - 1])
|
||||
for(y = [0:size[1] - 1])
|
||||
for(x = [0:size[0] - 1])
|
||||
[x, y, z]
|
||||
];
|
||||
|
||||
cells = [for(p = points) nz_worley3(p[0], p[1], p[2], seed, tile_w, dist)];
|
||||
|
||||
max_dist = max([for(c = cells) c[3]]);
|
||||
for(i = [0:len(cells) - 1]) {
|
||||
c = cells[i][3] / max_dist;
|
||||
color([c, c, c, c])
|
||||
translate(points[i])
|
||||
cube(1);
|
||||
}
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* nz_worley3.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2020
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley3.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <util/rand.scad>;
|
||||
use <noise/_impl/_nz_worley3_impl.scad>;
|
||||
|
||||
|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* nz_worley3s.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2020
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-nz_worley3s.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <util/rand.scad>;
|
||||
use <noise/_impl/_nz_worley3_impl.scad>;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user