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

61 lines
1.5 KiB
Markdown
Raw Normal View History

2021-06-30 10:57:02 +08:00
# sf_thickenT
It thickens a surface with triangular mesh.
## Parameters
- `points` : A list of `[x, y, z]`s.
- `thickness` : The depth of the thickening.
- `triangles` : Determine which points are connected by an edge. All triangles have points in the same direction, counter-clockwise. If it's ignored, `sf_thickenT` would use `[x, y]` to do Delaunay trianglation.
- `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_thickenT.scad>
2021-06-30 10:57:02 +08:00
thickness = .2;
2022-04-04 16:37:37 +08:00
a_step = 15;
2021-06-30 10:57:02 +08:00
r_step = 0.2;
2022-04-06 17:44:11 +08:00
function f(x, y) = (y ^ 2 - x ^ 2) / 4;
2021-06-30 10:57:02 +08:00
points = [
2022-04-04 16:31:44 +08:00
for(a = [a_step:a_step:360], r = [r_step:r_step:2])
let(
2022-04-04 16:37:37 +08:00
x = r * cos(a),
y = r * sin(a)
2022-04-04 16:31:44 +08:00
)
[x, y, f(x, y)]
2021-06-30 10:57:02 +08:00
];
sf_thickenT(points, thickness);
![sf_thickenT](images/lib3x-sf_thickenT-1.JPG)
2022-06-06 13:11:46 +08:00
use <triangle/tri_delaunay.scad>
use <surface/sf_thickenT.scad>
2021-06-30 10:57:02 +08:00
u_step = 10;
2021-06-30 17:57:05 +08:00
v_step = 0.2;
2021-06-30 10:57:02 +08:00
thickness = .2;
points = [
2022-04-04 16:31:44 +08:00
for(u = [0:u_step:360], v = [-1:v_step:1])
let(
x = (1 + v / 2 * cos(u / 2)) * cos(u),
y = (1 + v / 2 * cos(u / 2)) * sin(u),
z = v / 2 * sin(u / 2)
)
[x, y, z]
2021-06-30 10:57:02 +08:00
];
triangles = tri_delaunay([
for(u = [0:u_step:360])
2021-06-30 17:57:05 +08:00
for(v = [-1:v_step:1])
2021-06-30 10:57:02 +08:00
[v, u]
]);
sf_thickenT(points, thickness, triangles);
![sf_thickenT](images/lib3x-sf_thickenT-2.JPG)