1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
This commit is contained in:
Justin Lin 2021-06-22 17:58:06 +08:00
parent 0aaf599868
commit a43647ea41
5 changed files with 41 additions and 49 deletions

View File

@ -363,7 +363,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
--|-- --|--
[**surface/sf_curve**(levels, curve_path, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sf_curve.html) | curve a photo. [**surface/sf_curve**(levels, curve_path, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sf_curve.html) | curve a photo.
[**surface/sf_splines**(ctrl_pts, row_spline, column_spline)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sf_splines.html) | generalized-spline surface. [**surface/sf_splines**(ctrl_pts, row_spline, column_spline)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sf_splines.html) | generalized-spline surface.
**surface/sf_thicken**(points, thickness, ...) | thicken a surface. [**surface/sf_thicken**(points, thickness, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sf_thicken.html) | thicken a surface.
## Triangle ## Triangle

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -7,72 +7,64 @@ It thickens a surface, described by a m * n list of `[x, y, z]`s.
- `points` : A m * n list of `[x, y, z]`s. See examples below. - `points` : A m * n list of `[x, y, z]`s. See examples below.
- `thickness` : The depth of the thickening. - `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. - `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.
- `swap_surface` : The direction of thickening.
## Examples ## Examples
use <sf_thicken.scad>; use <surface/sf_thicken.scad>;
points = [ points = [
[[0, 0, 1], [1, 0, 2], [2, 0, 2], [3, 0, 3]], [[0, 0, 1], [1, 0, 2.5], [2, 0, 2], [3, 0, 2.5]],
[[0, 1, 1], [1, 1, 4], [2, 1, 0], [3, 1, 3]], [[0, 1, 1], [1, 1, 2], [2, 1, 1], [3, 1, 2]],
[[0, 2, 1], [1, 2, 3], [2, 2, 1], [3, 2, 3]], [[0, 2, 1], [1, 2, 2.3], [2, 2, 2], [3, 2, 2.2]],
[[0, 3, 1], [1, 3, 3], [2, 3, 1], [3, 3, 3]] [[0, 3, 1], [1, 3, 2], [2, 3, 1], [3, 3, 2]]
]; ];
thickness = 0.5; thickness = 0.25;
sf_thicken(points, thickness); sf_thicken(points, thickness);
![sf_thicken](images/lib3x-sf_thicken-1.JPG) ![sf_thicken](images/lib3x-sf_thicken-1.JPG)
use <sf_thicken.scad>; use <surface/sf_thicken.scad>;
function f(x, y) = function f(x, y) =
30 * ( 30 * (
cos(sqrt(pow(x, 2) + pow(y, 2))) + cos(sqrt(pow(x, 2) + pow(y, 2))) +
cos(3 * sqrt(pow(x, 2) + pow(y, 2))) cos(3 * sqrt(pow(x, 2) + pow(y, 2)))
); );
thickness = 2; thickness = 3;
min_value = -200; min_value = -200;
max_value = 200; max_value = 200;
resolution = 10; resolution = 10;
points = [ surface1 = [
for(y = [min_value:resolution:max_value]) for(y = [min_value:resolution:max_value])
[ [
for(x = [min_value:resolution:max_value]) for(x = [min_value:resolution:max_value])
[x, y, f(x, y)] [x, y, f(x, y) + 100]
] ]
]; ];
sf_thicken(surface1, thickness);
sf_thicken(points, thickness);
![sf_thicken](images/lib3x-sf_thicken-2.JPG) ![sf_thicken](images/lib3x-sf_thicken-2.JPG)
use <sf_thicken.scad>; use <surface/sf_thicken.scad>;
function f(x, y) = function f(x, y) = x + y;
30 * (
cos(sqrt(pow(x, 2) + pow(y, 2))) + thickness = 20;
cos(3 * sqrt(pow(x, 2) + pow(y, 2))) min_value = -50;
); max_value = 50;
resolution = 5;
thickness = 2;
min_value = -200; surface1 = [
max_value = 200; for(y = [min_value:resolution:max_value])
resolution = 10; [
style = "LINES"; for(x = [min_value:resolution:max_value])
[x, y, f(x, y) + 100]
points = [ ]
for(y = [min_value:resolution:max_value])
[
for(x = [min_value:resolution:max_value])
[x, y, f(x, y)]
]
]; ];
sf_thicken(surface1, thickness, direction = [1, 1, -1]);
sf_thicken(points, thickness, style);
![sf_thicken](images/lib3x-sf_thicken-3.JPG) ![sf_thicken](images/lib3x-sf_thicken-3.JPG)