1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/docs/lib3x-sf_thicken.md

68 lines
1.7 KiB
Markdown
Raw Normal View History

2021-06-22 17:45:25 +08:00
# sf_thicken
It thickens a surface, described by a m * n list of `[x, y, z]`s.
## Parameters
- `points` : A m * n list of `[x, y, z]`s. See examples below.
- `thickness` : The depth of the thickening.
- `direction` : The direction of thickening. It accepts `"BOTH"` (default), `"FORWARD"` or `"BACKWARD"`. Thickening is applied in both directions from the surface, the direction of the surface normals or the opposite direction to the surface normals. It also accept a direction vector `[x, y, z]`. Thickening is only applied in the direction you give.
## Examples
2022-06-06 13:11:46 +08:00
use <surface/sf_thicken.scad>
2021-06-22 17:58:06 +08:00
2021-06-22 17:45:25 +08:00
points = [
2021-06-22 17:58:06 +08:00
[[0, 0, 1], [1, 0, 2.5], [2, 0, 2], [3, 0, 2.5]],
[[0, 1, 1], [1, 1, 2], [2, 1, 1], [3, 1, 2]],
[[0, 2, 1], [1, 2, 2.3], [2, 2, 2], [3, 2, 2.2]],
[[0, 3, 1], [1, 3, 2], [2, 3, 1], [3, 3, 2]]
2021-06-22 17:45:25 +08:00
];
2021-06-22 17:58:06 +08:00
thickness = 0.25;
2021-06-22 17:45:25 +08:00
sf_thicken(points, thickness);
![sf_thicken](images/lib3x-sf_thicken-1.JPG)
2022-06-06 13:11:46 +08:00
use <surface/sf_thicken.scad>
2021-06-22 17:58:06 +08:00
2021-06-22 17:45:25 +08:00
function f(x, y) =
2022-04-06 17:44:11 +08:00
let(leng = norm([x, y]))
30 * (cos(leng) + cos(3 * leng));
2021-06-22 17:58:06 +08:00
thickness = 3;
2021-06-22 17:45:25 +08:00
min_value = -200;
max_value = 200;
resolution = 10;
2021-06-22 17:58:06 +08:00
surface1 = [
for(y = [min_value:resolution:max_value])
2022-04-06 17:44:11 +08:00
[
for(x = [min_value:resolution:max_value])
[x, y, f(x, y) + 100]
]
2021-06-22 17:45:25 +08:00
];
2021-06-22 17:58:06 +08:00
sf_thicken(surface1, thickness);
2021-06-22 17:45:25 +08:00
![sf_thicken](images/lib3x-sf_thicken-2.JPG)
2022-06-06 13:11:46 +08:00
use <surface/sf_thicken.scad>
2021-06-22 17:45:25 +08:00
2021-06-22 17:58:06 +08:00
function f(x, y) = x + y;
thickness = 20;
min_value = -50;
max_value = 50;
resolution = 5;
surface1 = [
for(y = [min_value:resolution:max_value])
2022-04-06 17:44:11 +08:00
[
for(x = [min_value:resolution:max_value])
[x, y, f(x, y) + 100]
]
2021-06-22 17:45:25 +08:00
];
2021-06-22 17:58:06 +08:00
sf_thicken(surface1, thickness, direction = [1, 1, -1]);
2021-06-22 17:45:25 +08:00
![sf_thicken](images/lib3x-sf_thicken-3.JPG)