1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00

update docs

This commit is contained in:
Justin Lin 2021-07-03 11:53:58 +08:00
parent 131c1aec83
commit 52f3d10175
10 changed files with 5 additions and 120 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

View File

@ -1,34 +0,0 @@
# bezier_surface
Given a set of control points, the `bezier_surface` function returns points of the Bézier surface. Combined with the `function_grapher` module defined in my library, you can create a Bézier surface.
## Parameters
- `t_step` : The distance between two points of the Bézier path.
- `points` : A set of control points. See examples below.
## Examples
If you have 16 control points and combine with the `function_grapher` module:
use <bezier_surface.scad>;
use <function_grapher.scad>;
t_step = 0.05;
thickness = 0.5;
ctrl_pts = [
[[0, 0, 20], [60, 0, -35], [90, 0, 60], [200, 0, 5]],
[[0, 50, 30], [100, 60, -25], [120, 50, 120], [200, 50, 5]],
[[0, 100, 0], [60, 120, 35], [90, 100, 60], [200, 100, 45]],
[[0, 150, 0], [60, 150, -35], [90, 180, 60], [200, 150, 45]]
];
g = bezier_surface(t_step, ctrl_pts);
function_grapher(g, thickness);
![bezier_surface](images/lib3x-bezier_surface-1.JPG)
The following figure shows controll points and bazier curves around the surface.
![bezier_surface](images/lib3x-bezier_surface-2.JPG)

View File

@ -12,7 +12,7 @@ Computes contour polygons by applying [marching squares](https://en.wikipedia.or
## Examples ## Examples
use <hull_polyline2d.scad>; use <hull_polyline2d.scad>;
use <function_grapher.scad>; use <surface/sf_thicken.scad>;
use <contours.scad>; use <contours.scad>;
min_value = 1; min_value = 1;
@ -29,7 +29,7 @@ Computes contour polygons by applying [marching squares](https://en.wikipedia.or
] ]
]; ];
function_grapher(points, 1); sf_thicken(points, 1);
translate([max_value, 0, 0]) translate([max_value, 0, 0])
for(z = [-30:5:30]) { for(z = [-30:5:30]) {

View File

@ -1,78 +0,0 @@
# function_grapher
Given a list of points `[x, y, f(x, y)]` where `f(x, y)` is a mathematics function, the `function_grapher` module can create the graph of `f(x, y)`.
## Parameters
- `points` : A list of points `[x, y, f(x, y)]`. See examples below.
- `thickness` : The face or line thickness. Default to 1.
- `style` : The style of the graph. It accepts `"FACES"`, `"LINES"`, `"HULL_FACES"` and `"HULL_LINES"`. The default value is `"FACES"` which simply takes `f(x, y) - thickness` for each point to build a bottom. It may cause thickness problems when slopes is high. The `"HULL_FACES"` value can solve the problem but is slow. When assigning `"LINES"`, it uses lines to connect points. The `"HULL_LINES"` is very very slow; however, the model might look smoother if you have a small `$fn`.
- `$fa`, `$fs`, `$fn` : Used by the `circle` or `sphere` module internally. It affects the speed of rending. For example, a large `$fn` may be very slow when rending. Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) or [the sphere module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#sphere) for more details.
## Examples
use <function_grapher.scad>;
points = [
[[0, 0, 1], [1, 0, 2], [2, 0, 2], [3, 0, 3]],
[[0, 1, 1], [1, 1, 4], [2, 1, 0], [3, 1, 3]],
[[0, 2, 1], [1, 2, 3], [2, 2, 1], [3, 2, 3]],
[[0, 3, 1], [1, 3, 3], [2, 3, 1], [3, 3, 3]]
];
thickness = 0.5;
function_grapher(points, thickness);
![function_grapher](images/lib3x-function_grapher-1.JPG)
use <function_grapher.scad>;
function f(x, y) =
30 * (
cos(sqrt(pow(x, 2) + pow(y, 2))) +
cos(3 * sqrt(pow(x, 2) + pow(y, 2)))
);
thickness = 2;
min_value = -200;
max_value = 200;
resolution = 10;
points = [
for(y = [min_value:resolution:max_value])
[
for(x = [min_value:resolution:max_value])
[x, y, f(x, y)]
]
];
function_grapher(points, thickness);
![function_grapher](images/lib3x-function_grapher-2.JPG)
use <function_grapher.scad>;
function f(x, y) =
30 * (
cos(sqrt(pow(x, 2) + pow(y, 2))) +
cos(3 * sqrt(pow(x, 2) + pow(y, 2)))
);
thickness = 2;
min_value = -200;
max_value = 200;
resolution = 10;
style = "LINES";
points = [
for(y = [min_value:resolution:max_value])
[
for(x = [min_value:resolution:max_value])
[x, y, f(x, y)]
]
];
function_grapher(points, thickness, style);
![function_grapher](images/lib3x-function_grapher-3.JPG)

View File

@ -14,7 +14,7 @@ Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value
use <util/rand.scad>; use <util/rand.scad>;
use <hull_polyline2d.scad>; use <hull_polyline2d.scad>;
use <function_grapher.scad>; use <surface/sf_thicken.scad>;
use <noise/nz_perlin2.scad>; use <noise/nz_perlin2.scad>;
use <contours.scad>; use <contours.scad>;
@ -27,11 +27,11 @@ Returns the 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) value
] ]
]; ];
function_grapher(points, 1); sf_thicken(points, .1);
translate([11, 0]) translate([11, 0])
for(isoline = contours(points, 0)) { for(isoline = contours(points, 0)) {
hull_polyline2d(isoline, width = .1); hull_polyline2d(isoline, width = .1);
} }
![nz_perlin2](images/lib3x-nz_perlin2-1.JPG) ![nz_perlin2](images/lib3x-nz_perlin2-1.JPG)

View File

@ -12,10 +12,7 @@ Returns 2D [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) values at
## Examples ## Examples
use <util/rand.scad>; use <util/rand.scad>;
use <hull_polyline2d.scad>;
use <function_grapher.scad>;
use <noise/nz_perlin2s.scad>; use <noise/nz_perlin2s.scad>;
use <contours.scad>;
seed = rand(0, 255); seed = rand(0, 255);