Compare commits
214 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bb33edfd75 | ||
|
8bfcdc39a9 | ||
|
5e60756a27 | ||
|
2ea9bcdffc | ||
|
f26629cb4c | ||
|
ea60a5628a | ||
|
c1d1997714 | ||
|
78a23c0a12 | ||
|
17d6364865 | ||
|
fbb4024168 | ||
|
fcdcf0b2b4 | ||
|
e75fd110d7 | ||
|
49461b3ce1 | ||
|
86028431bf | ||
|
c30e83d318 | ||
|
bd628815bd | ||
|
7a6ea23903 | ||
|
ebfc46fd26 | ||
|
469fdcc6f7 | ||
|
5578c169b0 | ||
|
b90b83ebc5 | ||
|
daaff1322f | ||
|
84c83769db | ||
|
bb59ba0939 | ||
|
3c70c23afa | ||
|
683074dc54 | ||
|
9d2f6eaac2 | ||
|
4c46ac11fc | ||
|
fb73eced66 | ||
|
7a890293fb | ||
|
7eff4d759e | ||
|
d78bed91e7 | ||
|
f875bacaf8 | ||
|
bc424ed7b3 | ||
|
ca7a0e7ef1 | ||
|
264d83cdf1 | ||
|
7af26906d0 | ||
|
ee0ffbabd3 | ||
|
ce257f859b | ||
|
4bdd3ca089 | ||
|
18281f72fc | ||
|
18d3757079 | ||
|
2d5a38194a | ||
|
02895d6529 | ||
|
29594b8688 | ||
|
d0ea27a76c | ||
|
ea8fc1da2b | ||
|
d29ab4eb8a | ||
|
824168a006 | ||
|
87ec19fb7a | ||
|
2602a90388 | ||
|
95b679d82a | ||
|
6e08ec5fdb | ||
|
6a98237517 | ||
|
4a9d935059 | ||
|
f587ffecd0 | ||
|
7689ac9c55 | ||
|
b832cbec2e | ||
|
174eb609d5 | ||
|
40dfebe040 | ||
|
795c7c0a87 | ||
|
a403ca060e | ||
|
995b531faf | ||
|
ce915abd33 | ||
|
631e78d642 | ||
|
2cf3ac6781 | ||
|
04e089613a | ||
|
232a2a56bf | ||
|
8fbf812bca | ||
|
582fc09262 | ||
|
3a4e6b2a19 | ||
|
bd64388362 | ||
|
a3933b945e | ||
|
9ef35e42bd | ||
|
ef07707cdb | ||
|
b33e725523 | ||
|
0c29e2b108 | ||
|
6b6f0d832a | ||
|
f35d04e0e6 | ||
|
1e1587c600 | ||
|
390bef0061 | ||
|
86d5da1e23 | ||
|
b83d9440c0 | ||
|
30b906a1c3 | ||
|
047c175a19 | ||
|
77f9750091 | ||
|
5b8e62a559 | ||
|
5b725bd6bb | ||
|
abd5683698 | ||
|
49a68a9f84 | ||
|
505e514075 | ||
|
11f9a5b58a | ||
|
3b1c12247c | ||
|
f732686823 | ||
|
15c1cd605f | ||
|
709c92714e | ||
|
ed75179dfe | ||
|
cb1ee004ce | ||
|
6d0eb7de03 | ||
|
a51a8f2bd4 | ||
|
e6e52f7ab8 | ||
|
4e2edcef5b | ||
|
756fde7c0f | ||
|
f278d7430a | ||
|
86e30155c8 | ||
|
97860fdf67 | ||
|
c93d1ae897 | ||
|
0a5d64d999 | ||
|
8eba081532 | ||
|
bcee313c0e | ||
|
4b7133252f | ||
|
7a6712d1b1 | ||
|
32995370d0 | ||
|
65b434878d | ||
|
22b14f7923 | ||
|
e4f3522143 | ||
|
d1f595dbf1 | ||
|
28278e814a | ||
|
fbe58944e8 | ||
|
dd63a9574e | ||
|
0c1e2049e2 | ||
|
7f3da91174 | ||
|
c63d5c0d47 | ||
|
160d2e67ac | ||
|
a6e74ca978 | ||
|
e39a7311f3 | ||
|
f2f7438257 | ||
|
e436e09923 | ||
|
10b99289c6 | ||
|
2fab2309fe | ||
|
0d19380f74 | ||
|
b384817b98 | ||
|
e66aeccd33 | ||
|
6df0170d81 | ||
|
c551e96352 | ||
|
b0c521f8c1 | ||
|
0e8b676c09 | ||
|
183b3b74b6 | ||
|
964e6b5020 | ||
|
c71143c113 | ||
|
5772dcbc55 | ||
|
243c3eb659 | ||
|
623878b75e | ||
|
b613b87536 | ||
|
90b4c830be | ||
|
f1fd2797a4 | ||
|
938507d02d | ||
|
2651a23524 | ||
|
ad4b54984b | ||
|
31e7ca6275 | ||
|
6a30eb0e76 | ||
|
464fcc5f8f | ||
|
669e7c4b1d | ||
|
ac4288d5f4 | ||
|
a169468da6 | ||
|
91b56e3a5a | ||
|
273f83bd27 | ||
|
45050f31cd | ||
|
fd666676d6 | ||
|
5330981a19 | ||
|
6bfe94ce1c | ||
|
9333145a6d | ||
|
0fc6e05d8f | ||
|
98ae52b828 | ||
|
dae4ee49cc | ||
|
5cde164bb5 | ||
|
7356046aa7 | ||
|
8ce4b435c6 | ||
|
1ee48d6f13 | ||
|
cdd5452618 | ||
|
95f69374e4 | ||
|
832174831f | ||
|
cf5d70c1ef | ||
|
0c4c338046 | ||
|
cdb403ae8e | ||
|
3046b8eacd | ||
|
8371943c25 | ||
|
e0b32b96b7 | ||
|
1b3ff91046 | ||
|
c3025ea51c | ||
|
e4661c74eb | ||
|
5cd9b7e7a0 | ||
|
89790d50ae | ||
|
6affac09a7 | ||
|
b80ea25688 | ||
|
8c3a7d7f7a | ||
|
e2ec67b67d | ||
|
8c88932588 | ||
|
c7ea5b384b | ||
|
a46e75c672 | ||
|
fb001c8752 | ||
|
0c534e6133 | ||
|
4d611bb0b5 | ||
|
f1d5d6e472 | ||
|
12e6ad672d | ||
|
e71ee91b90 | ||
|
27701333c7 | ||
|
238c2ede27 | ||
|
1fb449fdf6 | ||
|
bce7487a96 | ||
|
27536f28f6 | ||
|
9ce272b434 | ||
|
1c04072738 | ||
|
9996fe9fad | ||
|
b8ccb792af | ||
|
d9bbdce328 | ||
|
cc8522dd05 | ||
|
5a39846101 | ||
|
795ac56f50 | ||
|
6fa4fe0ea9 | ||
|
d5dd12ffcd | ||
|
bcc10201b3 | ||
|
a3b8fc41b5 | ||
|
e5d38e2d6f |
35
README.md
@@ -1,4 +1,4 @@
|
||||
# dotSCAD 3.2.2
|
||||
# dotSCAD 3.3
|
||||
|
||||
> **Reduce the burden of mathematics/algorithm when playing OpenSCAD.**
|
||||
|
||||
@@ -18,13 +18,13 @@ OpenSCAD uses three library locations, the installation library, built-in librar
|
||||
|
||||
Every public module/function has the same name as the .scad file. Here's an example using the `line2d` module:
|
||||
|
||||
use <line2d.scad>;
|
||||
use <line2d.scad>
|
||||
|
||||
line2d(p1 = [0, 0], p2 = [5, 0], width = 1);
|
||||
|
||||
The library uses directories to categorize some modules/functions. For example, vx_circle.scad exists in `voxel` directory. Prefix the directory name when using `vx_circle`.
|
||||
|
||||
use <voxel/vx_circle.scad>;
|
||||
use <voxel/vx_circle.scad>
|
||||
|
||||
points = vx_circle(radius = 10);
|
||||
for(pt = points) {
|
||||
@@ -94,7 +94,6 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**cross_sections**(shape_pts, path_pts, angles[, twist, scale])](https://openhome.cc/eGossip/OpenSCAD/lib3x-cross_sections.html) | given a 2D shape, points and angles along the path, this function returns all cross-sections.
|
||||
[**in_polyline**(line_pts, pt[, epsilon])](https://openhome.cc/eGossip/OpenSCAD/lib3x-in_polyline.html) | check whether a point is on a line.
|
||||
[**lines_intersection**(line1, line2[, ext, epsilon])](https://openhome.cc/eGossip/OpenSCAD/lib3x-lines_intersection.html) | find the intersection of two line segments. Return `[]` if lines don't intersect.
|
||||
[**rails2sections**(rails)](https://openhome.cc/eGossip/OpenSCAD/lib3x-rails2sections.html) | create sections along rails.
|
||||
[**path_scaling_sections**(shape_pts, edge_path)](https://openhome.cc/eGossip/OpenSCAD/lib3x-path_scaling_sections.html) | given an edge path with the first point at the outline of a shape, this function uses the path to calculate scaling factors and returns all scaled sections in the reversed order of the edge path.
|
||||
[**midpt_smooth**(points, n[, closed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-midpt_smooth.html) | given a 2D path, this function constructs a mid-point smoothed version by joining the mid-points of the lines of the path.
|
||||
|
||||
@@ -159,19 +158,20 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**util/bsearch**(sorted, target)](https://openhome.cc/eGossip/OpenSCAD/lib3x-bsearch.html) | search a value in a list whose elements must be sorted by zyx.
|
||||
[**util/has**(lt, elem[, sorted])](https://openhome.cc/eGossip/OpenSCAD/lib3x-has.html) | return `true` if `lt` contains elem.
|
||||
[**util/binary_search**(sorted, target[, lo, hi])](https://openhome.cc/eGossip/OpenSCAD/lib3x-binary_search.html) | search a value in a sorted list.
|
||||
[**util/contains**(lt, elem)](https://openhome.cc/eGossip/OpenSCAD/lib3x-contains.html) | return `true` if `lt` contains `elem`.
|
||||
[**util/find_index**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-find_index.html) | return the index of the first element that satisfies the testing function.
|
||||
[**util/dedup**(lt, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-dedup.html) | eliminate duplicate vectors.
|
||||
[**util/flat**(lt[, depth])](https://openhome.cc/eGossip/OpenSCAD/lib3x-flat.html) | return a new list with all sub-list elements concatenated into it recursively up to the specified depth.
|
||||
[**util/reverse**(lt)](https://openhome.cc/eGossip/OpenSCAD/lib3x-reverse.html) | reverse a list.
|
||||
[**util/slice**(lt, begin, end)](https://openhome.cc/eGossip/OpenSCAD/lib3x-slice.html) | return a list selected from `begin` to `end`, or to the `end` of the list (`end` not included).
|
||||
[**util/sort**(lt[, by, idx])](https://openhome.cc/eGossip/OpenSCAD/lib3x-sort.html) | sort a list.
|
||||
[**util/sorted**(lt[, cmp, key, reverse])](https://openhome.cc/eGossip/OpenSCAD/lib3x-sorted.html) | sort a list.
|
||||
[**util/sum**(lt)](https://openhome.cc/eGossip/OpenSCAD/lib3x-sum.html) | use `+` to sum up all elements in a list.
|
||||
[**util/swap**(lt, i, j)](https://openhome.cc/eGossip/OpenSCAD/lib3x-swap.html) | swap two elements in a list.
|
||||
[**util/zip**(lts, combine)](https://openhome.cc/eGossip/OpenSCAD/lib3x-zip.html) | make a list that aggregates elements from each of the lists.
|
||||
[**util/every**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-every.html) | test whether all elements in the list pass the test implemented by the provided function.
|
||||
[**util/some**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-some.html) | test whether at least one element in the list passes the test implemented by the provided function.
|
||||
[**util/count**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-count.html) | return the number of times `test` return `true` in the list.
|
||||
|
||||
### util/random
|
||||
|
||||
@@ -235,6 +235,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**matrix/m_shearing**([sx, sy, sz])](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_shearing.html) | generate a transformation matrix which can pass into `multmatrix` to shear all child elements along the X-axis, Y-axis, or Z-axis in 3D.
|
||||
[**matrix/m_translation**(v)](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_translation.html) | generate a transformation matrix which can pass into multmatrix to translates (moves) its child elements along the specified vector.
|
||||
[**maxtrix/m_transpose**(m)](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_transpose.html) | transpose a matrix.
|
||||
[**matrix/m_replace**(m, i, j, value)](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_replace.html) | replace the aᵢⱼ element of a matrix.
|
||||
|
||||
## Point Transformation
|
||||
|
||||
@@ -260,6 +261,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**triangle/tri_delaunay_indices**(d)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_delaunay_indices.html) | return triangle indices from a delaunay object.
|
||||
[**triangle/tri_delaunay_shapes**(d)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_delaunay_shapes.html) | return triangle shapes from a delaunay object.
|
||||
[**triangle/tri_delaunay_voronoi**(d)](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_delaunay_voronoi.html) | return [Voronoi](https://en.wikipedia.org/wiki/Voronoi_diagram) cells from a delaunay object.
|
||||
[**triangle/tri_subdivide**(shape_pts[, n])](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_subdivide.html) | subdivide a triangle `n` times.
|
||||
|
||||
----
|
||||
|
||||
@@ -349,14 +351,15 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**maze/mz_square_cells**(rows, columns[, start, ...])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_cells.html) | return cell data of a square maze.
|
||||
[**maze/mz_square**([rows, columns, start, init_cells, x_wrapping, y_wrapping, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square.html) | return cell data of a square maze.
|
||||
[**maze/mz_square_get**(cell, query)](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_get.html) | a helper for getting data from a square-maze cell.
|
||||
[**maze/mz_square_walls**(cells, rows, columns, cell_width, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_walls.html) | a helper for creating square wall data from maze cells.
|
||||
[**maze/mz_hex_walls**(cells, rows, columns, cell_radius, ...)](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hex_walls.html) | a helper for creating hex wall data from maze cells.
|
||||
[**maze/mz_squarewalls**(cells, cell_width[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_squarewalls.html) | a helper for creating square wall data from maze cells.
|
||||
[**maze/mz_hexwalls**(cells, cell_radius[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hexwalls.html) | a helper for creating hex wall data from maze cells.
|
||||
[**maze/mz_square_initialize**(rows, columns, mask)](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_initialize.html) | a helper for initializing cell data of a maze.
|
||||
[**maze/mz_hamiltonian**(rows, columns[, start, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hamiltonian.html) | create a hamiltonian path from a maze.
|
||||
[**maze/mz_theta_cells**(rows, beginning_number[, start, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta_cells.html) | return cell data of a theta maze.
|
||||
[**maze/mz_theta_get**(cell, query)](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta_get.html) | a helper for getting data from a theta-maze cell.
|
||||
[**maze/mz_theta**(rings, beginning_number[, start, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta.html) | return cell data of a theta maze.
|
||||
[**maze/mz_tiles**(cells[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_tiles.html) | turn maze cells into tiles.
|
||||
|
||||
## Polyhedra
|
||||
|
||||
@@ -371,5 +374,13 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**polyhedra/icosahedron**(radius[, detail])](https://openhome.cc/eGossip/OpenSCAD/lib3x-polyhedra_icosahedron.html) | create a icosahedron.
|
||||
[**polyhedra/superellipsoid**(radius[, detail])](https://openhome.cc/eGossip/OpenSCAD/lib3x-polyhedra_superellipsoid.html) | create a superellipsoid.
|
||||
|
||||
----
|
||||
## Point Picking
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**pp/pp_disk**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_disk.html) | generate random points over a disk.
|
||||
[**pp/pp_sphere**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_sphere.html) | pick random points on the surface of a sphere.
|
||||
[**pp/pp_poisson2**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson2.html) | perform poisson sampling over a rectangle area.
|
||||
[**pp/pp_poisson3**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson3.html) | perform poisson sampling over a cube space.
|
||||
|
||||
----
|
57
RELEASE.md
@@ -1,5 +1,62 @@
|
||||
> Version numbers are based on [Semantic Versioning](https://semver.org/).
|
||||
|
||||
# v3.3
|
||||
|
||||
## Deprecated
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
**rails2sections** | use [`maxtrix/m_transpose`](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_transpose.html) instead.
|
||||
**util/sort** | use [`util/sorted`](https://openhome.cc/eGossip/OpenSCAD/lib3x-sorted.html) instead.
|
||||
**util/has** | use [`util/contains`](https://openhome.cc/eGossip/OpenSCAD/lib3x-contains.html) instead.
|
||||
**util/bsearch** | use [`util/binary_search`](https://openhome.cc/eGossip/OpenSCAD/lib3x-binary_search.html) instead.
|
||||
**maze/mz_square_cells** | use [`maze/mz_square`](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square.html).
|
||||
**maze/mz_square_walls** | use [`maze/mz_squarewalls`](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_squarewalls.html) instead.
|
||||
**maze/mz_hex_walls** | use [`maze/mz_hexwalls`](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hexwalls.html) instead.
|
||||
**maze/mz_theta_cells** | use [`maze/mz_theta`](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta.html) instead.
|
||||
|
||||
|
||||
## Util
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**util/sorted**(lt[, cmp, key, reverse])](https://openhome.cc/eGossip/OpenSCAD/lib3x-sorted.html) | sort a list.
|
||||
[**util/contains**(lt, elem)](https://openhome.cc/eGossip/OpenSCAD/lib3x-contains.html) | return `true` if `lt` contains `elem`.
|
||||
[**util/binary_search**(sorted, target[, lo, hi])](https://openhome.cc/eGossip/OpenSCAD/lib3x-binary_search.html) | search a value in a sorted list.
|
||||
[**util/count**(lt, test)](https://openhome.cc/eGossip/OpenSCAD/lib3x-count.html) | return the number of times `test` return `true` in the list.
|
||||
|
||||
## Matrix
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**matrix/m_replace**(m, i, j, value)](https://openhome.cc/eGossip/OpenSCAD/lib3x-m_replace.html) | replace the aᵢⱼ element of a matrix.
|
||||
|
||||
## Triangle
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**triangle/tri_subdivide**(shape_pts[, n])](https://openhome.cc/eGossip/OpenSCAD/lib3x-tri_subdivide.html) | subdivide a triangle `n` times.
|
||||
|
||||
## Point Picking
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**pp/pp_disk**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_disk.html) | generate random points over a disk.
|
||||
[**pp/pp_sphere**(radius, value_count[, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_sphere.html) | pick random points on the surface of a sphere.
|
||||
[**pp/pp_poisson2**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson2.html) | perform poisson sampling over a rectangle area.
|
||||
[**pp/pp_poisson3**(size, r[, start, k, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-pp_poisson3.html) | perform poisson sampling over a cube space.
|
||||
|
||||
## Maze
|
||||
|
||||
Signature | Description
|
||||
--|--
|
||||
[**maze/mz_square**([rows, columns, start, init_cells, x_wrapping, y_wrapping, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square.html) | return cell data of a square maze.
|
||||
[**maze/mz_squarewalls**(cells, cell_width[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_squarewalls.html) | a helper for creating square wall data from maze cells.
|
||||
[**maze/mz_hexwalls**(cells, cell_radius[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hexwalls.html) | a helper for creating hex wall data from maze cells.
|
||||
[**maze/mz_theta**(rings, beginning_number[, start, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta.html) | return cell data of a theta maze.
|
||||
[**maze/mz_tiles**(cells[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_tiles.html) | turn maze cells into tiles.
|
||||
|
||||
|
||||
# v3.2.2
|
||||
|
||||
Maintenance release: bug fixes & performance improvements.
|
||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 67 KiB |
BIN
docs/images/lib3x-mz_hexwalls-1.JPG
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
docs/images/lib3x-mz_square-1.JPG
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/lib3x-mz_squarewalls-1.JPG
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/lib3x-mz_theta-1.JPG
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
docs/images/lib3x-mz_theta-2.JPG
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
docs/images/lib3x-mz_theta-3.JPG
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
docs/images/lib3x-mz_tiles-1.JPG
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
docs/images/lib3x-mz_tiles-2.JPG
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/lib3x-mz_tiles-3.JPG
Normal file
After Width: | Height: | Size: 132 KiB |
BIN
docs/images/lib3x-pp_disk-1.JPG
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/images/lib3x-pp_poisson2-1.JPG
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
docs/images/lib3x-pp_poisson3-1.JPG
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
docs/images/lib3x-pp_sphere-1.JPG
Normal file
After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
BIN
docs/images/lib3x-tri_subdivide-1.JPG
Normal file
After Width: | Height: | Size: 32 KiB |
@@ -12,8 +12,8 @@ If you want to place objects precisely, their points and angles are required. Wh
|
||||
|
||||
## Examples
|
||||
|
||||
use <along_with.scad>;
|
||||
use <shape_circle.scad>;
|
||||
use <along_with.scad>
|
||||
use <shape_circle.scad>
|
||||
|
||||
$fn = 24;
|
||||
|
||||
@@ -24,8 +24,8 @@ If you want to place objects precisely, their points and angles are required. Wh
|
||||
|
||||

|
||||
|
||||
use <along_with.scad>;
|
||||
use <shape_circle.scad>;
|
||||
use <along_with.scad>
|
||||
use <shape_circle.scad>
|
||||
|
||||
$fn = 24;
|
||||
|
||||
@@ -44,8 +44,8 @@ If you want to place objects precisely, their points and angles are required. Wh
|
||||
|
||||

|
||||
|
||||
use <along_with.scad>;
|
||||
use <golden_spiral.scad>;
|
||||
use <along_with.scad>
|
||||
use <golden_spiral.scad>
|
||||
|
||||
pts_angles = golden_spiral(
|
||||
from = 5,
|
||||
@@ -63,8 +63,8 @@ If you want to place objects precisely, their points and angles are required. Wh
|
||||
|
||||

|
||||
|
||||
use <bezier_curve.scad>;
|
||||
use <along_with.scad>;
|
||||
use <bezier_curve.scad>
|
||||
use <along_with.scad>
|
||||
|
||||
module scales() {
|
||||
module one_scale() {
|
||||
|
@@ -11,7 +11,7 @@ Returns the angle between two vectors.
|
||||
|
||||
## Examples
|
||||
|
||||
use <angle_between.scad>;
|
||||
use <angle_between.scad>
|
||||
|
||||
assert(angle_between([0, 1], [1, 0]) == 90);
|
||||
assert(angle_between([0, 1, 0], [1, 0, 0]) == 90);
|
||||
|
@@ -13,7 +13,7 @@ Creates an arc. You can pass a 2 element vector to define the central angle. Its
|
||||
|
||||
## Examples
|
||||
|
||||
use <arc.scad>;
|
||||
use <arc.scad>
|
||||
|
||||
$fn = 24;
|
||||
arc(radius = 20, angle = [45, 290], width = 2);
|
||||
@@ -21,7 +21,7 @@ Creates an arc. You can pass a 2 element vector to define the central angle. Its
|
||||
|
||||

|
||||
|
||||
use <arc.scad>;
|
||||
use <arc.scad>
|
||||
|
||||
$fn = 24;
|
||||
arc(radius = 20, angle = [45, 290], width = 2, width_mode = "LINE_OUTWARD");
|
||||
@@ -29,7 +29,7 @@ Creates an arc. You can pass a 2 element vector to define the central angle. Its
|
||||
|
||||

|
||||
|
||||
use <arc.scad>;
|
||||
use <arc.scad>
|
||||
|
||||
$fn = 24;
|
||||
arc(radius = 20, angle = [45, 290], width = 2, width_mode = "LINE_INWARD");
|
||||
|
@@ -11,8 +11,8 @@ Creates an arc path. You can pass a 2 element vector to define the central angle
|
||||
|
||||
## Examples
|
||||
|
||||
use <arc_path.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <arc_path.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
$fn = 24;
|
||||
points = arc_path(radius = 20, angle = [45, 290]);
|
||||
@@ -21,8 +21,8 @@ Creates an arc path. You can pass a 2 element vector to define the central angle
|
||||
|
||||

|
||||
|
||||
use <arc_path.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <arc_path.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
$fn = 24;
|
||||
points = arc_path(radius = 20, angle = 135);
|
||||
|
@@ -16,8 +16,8 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline2d.scad>;
|
||||
use <archimedean_spiral.scad>;
|
||||
use <polyline2d.scad>
|
||||
use <archimedean_spiral.scad>
|
||||
|
||||
points_angles = archimedean_spiral(
|
||||
arm_distance = 10,
|
||||
@@ -32,7 +32,7 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
||||
|
||||

|
||||
|
||||
use <archimedean_spiral.scad>;
|
||||
use <archimedean_spiral.scad>
|
||||
|
||||
points_angles = archimedean_spiral(
|
||||
arm_distance = 10,
|
||||
@@ -48,7 +48,7 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
||||
|
||||

|
||||
|
||||
use <archimedean_spiral.scad>;
|
||||
use <archimedean_spiral.scad>
|
||||
|
||||
t = "3.141592653589793238462643383279502884197169399375105820974944592307816406286";
|
||||
|
||||
|
@@ -14,7 +14,7 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||
## Examples
|
||||
|
||||
use <archimedean_spiral_extrude.scad>;
|
||||
use <archimedean_spiral_extrude.scad>
|
||||
|
||||
shape_pts = [
|
||||
[5, 0],
|
||||
|
@@ -14,8 +14,8 @@ Creates visually even spacing of n points on the surface of the sphere. Successi
|
||||
|
||||
## Examples
|
||||
|
||||
use <bauer_spiral.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <bauer_spiral.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
n = 200;
|
||||
radius = 20;
|
||||
|
@@ -12,7 +12,7 @@ Bends a 3D object into an arc shape.
|
||||
|
||||
The containing cube of the target object should be laid down on the x-y plane. For example.
|
||||
|
||||
use <bend.scad>;
|
||||
use <bend.scad>
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
@@ -25,7 +25,7 @@ The containing cube of the target object should be laid down on the x-y plane. F
|
||||
|
||||
Once you have the size of the containing cube, you can use it as the `size` argument of the `bend` module.
|
||||
|
||||
use <bend.scad>;
|
||||
use <bend.scad>
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
@@ -41,7 +41,7 @@ Once you have the size of the containing cube, you can use it as the `size` argu
|
||||
|
||||
The arc shape is smoother if the `frags` value is larger.
|
||||
|
||||
use <bend.scad>;
|
||||
use <bend.scad>
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
|
@@ -25,7 +25,7 @@ The containing square of the target shape should be laid down on the x-y plane.
|
||||
|
||||
Once you have the size of the containing square, you can use it as the `size` argument of the `bend_extrude` module.
|
||||
|
||||
use <bend_extrude.scad>;
|
||||
use <bend_extrude.scad>
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
|
@@ -11,8 +11,8 @@ Given a set of control points, the `bezier_curve` function returns points of the
|
||||
|
||||
If you have four control points:
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <bezier_curve.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <bezier_curve.scad>
|
||||
|
||||
t_step = 0.05;
|
||||
radius = 2;
|
||||
|
@@ -12,8 +12,8 @@ Given a path, the `bezier_smooth` function uses bazier curves to smooth all corn
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <bezier_smooth.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <bezier_smooth.scad>
|
||||
|
||||
width = 2;
|
||||
round_d = 15;
|
||||
@@ -37,7 +37,7 @@ Given a path, the `bezier_smooth` function uses bazier curves to smooth all corn
|
||||
|
||||

|
||||
|
||||
use <bezier_smooth.scad>;
|
||||
use <bezier_smooth.scad>
|
||||
|
||||
round_d = 10;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ Move 2D outlines outward or inward by a given amount. Each point of the offsette
|
||||
|
||||
## Examples
|
||||
|
||||
use <bijection_offset.scad>;
|
||||
use <bijection_offset.scad>
|
||||
|
||||
shape = [
|
||||
[15, 0],
|
||||
@@ -32,9 +32,9 @@ Move 2D outlines outward or inward by a given amount. Each point of the offsette
|
||||
|
||||

|
||||
|
||||
use <bijection_offset.scad>;
|
||||
use <path_extrude.scad>;
|
||||
use <bezier_curve.scad>;
|
||||
use <bijection_offset.scad>
|
||||
use <path_extrude.scad>
|
||||
use <bezier_curve.scad>
|
||||
|
||||
shape = [
|
||||
[5, 0],
|
||||
|
28
docs/lib3x-binary_search.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# binary_search
|
||||
|
||||
A general-purpose function to search a value in a sorted list.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `sorted` : The sorted list.
|
||||
- `target` : The target element or a function literal that returns a negative integer, zero, or a positive integer as the element is less than, equal to, or greater than the value you want to search.
|
||||
- `lo` : Default to 0. The lower bound to be searched.
|
||||
- `hi` : Default to the end of the list. The higher bound to be searched.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/sorted.scad>
|
||||
use <util/binary_search.scad>
|
||||
|
||||
points = [[1, 1], [3, 4], [7, 2], [5, 2]];
|
||||
lt = sorted(points); // [[1, 1], [3, 4], [5, 2], [7, 2]]
|
||||
|
||||
assert(binary_search(lt, [7, 2]) == 3);
|
||||
|
||||
xIs5 = function(elem) elem[0] - 5;
|
||||
assert(binary_search(lt, xIs5) == 2);
|
||||
|
||||
yIs4 = function(elem) elem[1] - 4;
|
||||
assert(binary_search(lt, yIs4) == 1);
|
@@ -12,14 +12,14 @@ Creates a box (container) from a 2D object.
|
||||
|
||||
## Examples
|
||||
|
||||
use <box_extrude.scad>;
|
||||
use <box_extrude.scad>
|
||||
|
||||
box_extrude(height = 30, shell_thickness = 2)
|
||||
circle(r = 30);
|
||||
|
||||

|
||||
|
||||
use <box_extrude.scad>;
|
||||
use <box_extrude.scad>
|
||||
|
||||
box_extrude(height = 30, shell_thickness = 2)
|
||||
text("XD", size = 40, font = "Cooper Black");
|
||||
|
@@ -11,8 +11,8 @@ The `bsearch` function is a general-purpose function to search a value in a list
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/sort.scad>;
|
||||
use <util/bsearch.scad>;
|
||||
use <util/sort.scad>
|
||||
use <util/bsearch.scad>
|
||||
|
||||
points = [[1, 1], [3, 4], [7, 2], [5, 2]];
|
||||
sorted = sort(points, by = "vt"); // [[1, 1], [5, 2], [7, 2], [3, 4]]
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
## Examples
|
||||
|
||||
use <bspline_curve.scad>;
|
||||
use <bspline_curve.scad>
|
||||
|
||||
points = [
|
||||
[-10, 0],
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||

|
||||
|
||||
use <bspline_curve.scad>;
|
||||
use <bspline_curve.scad>
|
||||
|
||||
points = [
|
||||
[-10, 0],
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||

|
||||
|
||||
use <bspline_curve.scad>;
|
||||
use <bspline_curve.scad>
|
||||
|
||||
points = [
|
||||
[-10, 0],
|
||||
|
@@ -11,6 +11,6 @@ Choose an element from the given list randomly.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/choose.scad>;
|
||||
use <util/choose.scad>
|
||||
|
||||
echo(choose([1, 2, 3, 4]));
|
@@ -10,7 +10,7 @@ Sometimes you need all points on the path of a circle. Here's the function. Its
|
||||
|
||||
## Examples
|
||||
|
||||
use <circle_path.scad>;
|
||||
use <circle_path.scad>
|
||||
|
||||
$fn = 24;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ Create a cone for rotatable models.
|
||||
|
||||
## Examples
|
||||
|
||||
use <part/cone.scad>;
|
||||
use <part/cone.scad>
|
||||
|
||||
radius = 2.5;
|
||||
length = 2;
|
||||
@@ -41,7 +41,7 @@ Create a cone for rotatable models.
|
||||
|
||||

|
||||
|
||||
use <part/cone.scad>;
|
||||
use <part/cone.scad>
|
||||
|
||||
radius = 2.5;
|
||||
length = 2;
|
||||
|
@@ -17,7 +17,7 @@ Create a connector peg.
|
||||
|
||||
## Examples
|
||||
|
||||
use <part/connector_peg.scad>;
|
||||
use <part/connector_peg.scad>
|
||||
|
||||
radius = 2.5;
|
||||
spacing = 0.5;
|
||||
@@ -37,7 +37,7 @@ Create a connector peg.
|
||||
|
||||

|
||||
|
||||
use <part/connector_peg.scad>;
|
||||
use <part/connector_peg.scad>
|
||||
|
||||
radius = 2.5;
|
||||
spacing = 0.5;
|
||||
|
19
docs/lib3x-contains.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# contains
|
||||
|
||||
If `lt` contains `elem`, this function returns `true`.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : A list of vectors.
|
||||
- `elem` : A element.
|
||||
|
||||
## Examples
|
||||
|
||||
use <voxel/vx_circle.scad>
|
||||
use <util/contains.scad>
|
||||
|
||||
pts = vx_circle(10);
|
||||
assert(contains(pts, [2, -10]));
|
||||
assert(!contains(pts, [0, 0]));
|
@@ -11,9 +11,9 @@ Computes contour polygons by applying [marching squares](https://en.wikipedia.or
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <surface/sf_thicken.scad>;
|
||||
use <contours.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <surface/sf_thicken.scad>
|
||||
use <contours.scad>
|
||||
|
||||
min_value = 1;
|
||||
max_value = 360;
|
||||
|
15
docs/lib3x-count.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# count
|
||||
|
||||
Returns the number of times `test` return `true` in the list.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The list.
|
||||
- `test` : A testing function.
|
||||
|
||||
## Examples
|
||||
|
||||
points = [[7, 2, 2], [1, 1, 2], [3, 4, 2], [3, 4, 2], [1, 2, 3]];
|
||||
assert(count(points, function(p) norm(p) > 5) == 3);
|
@@ -12,9 +12,9 @@ Given a 2D shape, points and angles along the path, this function will return al
|
||||
|
||||
## Examples
|
||||
|
||||
use <sweep.scad>;
|
||||
use <cross_sections.scad>;
|
||||
use <archimedean_spiral.scad>;
|
||||
use <sweep.scad>
|
||||
use <cross_sections.scad>
|
||||
use <archimedean_spiral.scad>
|
||||
|
||||
shape_pts = [
|
||||
[-2, -10],
|
||||
|
@@ -14,7 +14,7 @@ Uses spherical coordinate system to create a crystal ball.
|
||||
|
||||
## Examples
|
||||
|
||||
use <crystal_ball.scad>;
|
||||
use <crystal_ball.scad>
|
||||
|
||||
crystal_ball(radius = 6);
|
||||
|
||||
|
@@ -16,8 +16,8 @@ Draws a curved line from control points. The curve is drawn only from the 2nd co
|
||||
|
||||
## Examples
|
||||
|
||||
use <curve.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <curve.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
pts = [
|
||||
[28, 2, 1],
|
||||
|
@@ -13,6 +13,8 @@ Eliminating duplicate copies of repeating vectors.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/dedup.scad>
|
||||
|
||||
eq = function(e1, e2) e1[0] == e2[0] && e1[1] == e2[1] && e1[2] == e2[2];
|
||||
|
||||
points = [[1, 1, 2], [3, 4, 2], [7, 2, 2], [3, 4, 2], [1, 2, 3]];
|
||||
|
@@ -10,6 +10,6 @@ Converts a radian measurement to the corresponding value in degrees.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/degrees.scad>;
|
||||
use <util/degrees.scad>
|
||||
|
||||
assert(degrees(PI) == 180);
|
||||
|
@@ -10,7 +10,7 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem
|
||||
|
||||
## Examples
|
||||
|
||||
use <ellipse_extrude.scad>;
|
||||
use <ellipse_extrude.scad>
|
||||
|
||||
semi_minor_axis = 5;
|
||||
|
||||
@@ -19,7 +19,7 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem
|
||||
|
||||

|
||||
|
||||
use <ellipse_extrude.scad>;
|
||||
use <ellipse_extrude.scad>
|
||||
|
||||
semi_minor_axis = 5;
|
||||
|
||||
@@ -28,7 +28,7 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem
|
||||
|
||||

|
||||
|
||||
use <ellipse_extrude.scad>;
|
||||
use <ellipse_extrude.scad>
|
||||
|
||||
semi_minor_axis = 5;
|
||||
|
||||
@@ -41,7 +41,7 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem
|
||||
|
||||

|
||||
|
||||
use <ellipse_extrude.scad>;
|
||||
use <ellipse_extrude.scad>
|
||||
|
||||
semi_minor_axis = 10;
|
||||
|
||||
|
@@ -11,7 +11,7 @@ The `every` function tests whether all elements in the list pass the test implem
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/every.scad>;
|
||||
use <util/every.scad>
|
||||
|
||||
biggerThanZero = function(elem) elem > 0;
|
||||
assert(every([1, 30, 39, 29, 10, 13], biggerThanZero));
|
@@ -1,6 +1,6 @@
|
||||
# fibonacci_lattice
|
||||
|
||||
Creates visually even spacing of n points on the surface of the sphere. Nearest-neighbor points will all be approximately the same distance apart. There're 8 spirals on the sphere.
|
||||
Creates visually even spacing of n points on the surface of the sphere. Nearest-neighbor points will all be approximately the same distance apart.
|
||||
|
||||
(It's called "visually even spacing" because only the vertices of the 5 [Platonic solids](https://en.wikipedia.org/wiki/Platonic_solid) can be said to be truly evenly spaced around the surface of a sphere.)
|
||||
|
||||
@@ -14,7 +14,7 @@ Creates visually even spacing of n points on the surface of the sphere. Nearest-
|
||||
|
||||
## Examples
|
||||
|
||||
use <fibonacci_lattice.scad>;
|
||||
use <fibonacci_lattice.scad>
|
||||
|
||||
n = 200;
|
||||
radius = 20;
|
||||
@@ -29,9 +29,9 @@ Creates visually even spacing of n points on the surface of the sphere. Nearest-
|
||||
|
||||
|
||||

|
||||
|
||||
use <fibonacci_lattice.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
use <fibonacci_lattice.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
n = 200;
|
||||
radius = 20;
|
||||
@@ -41,16 +41,18 @@ Creates visually even spacing of n points on the surface of the sphere. Nearest-
|
||||
translate(p)
|
||||
sphere(1);
|
||||
}
|
||||
|
||||
sphere(radius);
|
||||
|
||||
spirals = [for(j = [0:7])
|
||||
[for(i = j; i < len(pts); i = i + 8) pts[i]]
|
||||
sphere(radius * 0.9);
|
||||
|
||||
// You can pick spirals from points.
|
||||
spirals = [for(j = [0:20])
|
||||
[for(i = j; i < len(pts); i = i + 21) pts[i]]
|
||||
];
|
||||
|
||||
|
||||
for(spiral = spirals) {
|
||||
polyline_join(spiral)
|
||||
sphere(.5);
|
||||
sphere(.25);
|
||||
}
|
||||
|
||||

|
@@ -11,6 +11,6 @@ Generate a Fibonacci sequence.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/fibseq.scad>;
|
||||
use <util/fibseq.scad>
|
||||
|
||||
echo(fibseq(1, 10)); // ECHO: [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
|
||||
|
@@ -11,6 +11,6 @@ Returns the index of the first element in the list that satisfies the testing fu
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/find_index.scad>;
|
||||
use <util/find_index.scad>
|
||||
|
||||
assert(find_index([10, 20, 30, 40], function(e) e > 10) == 1);
|
@@ -11,7 +11,7 @@ returns a new list with all sub-list elements concatenated into it recursively u
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/flat.scad>;
|
||||
use <util/flat.scad>
|
||||
|
||||
vt = [[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]];
|
||||
|
||||
|
@@ -11,8 +11,8 @@ Drive a turtle with `["forward", length]` or `["turn", angle]`. This function is
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <turtle/footprints2.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <turtle/footprints2.scad>
|
||||
|
||||
function arc_cmds(radius, angle, steps) =
|
||||
let(
|
||||
|
@@ -11,8 +11,8 @@ A 3D verion of [footprint2](https://openhome.cc/eGossip/OpenSCAD/lib3x-footprint
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <turtle/footprints3.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <turtle/footprints3.scad>
|
||||
|
||||
function xy_arc_cmds(radius, angle, steps) =
|
||||
let(
|
||||
|
@@ -13,7 +13,7 @@ It returns a vector of `[[x, y], angle]`.
|
||||
|
||||
## Examples
|
||||
|
||||
use <golden_spiral.scad>;
|
||||
use <golden_spiral.scad>
|
||||
|
||||
pts_angles = golden_spiral(
|
||||
from = 3,
|
||||
@@ -28,7 +28,7 @@ It returns a vector of `[[x, y], angle]`.
|
||||
|
||||

|
||||
|
||||
use <golden_spiral.scad>;
|
||||
use <golden_spiral.scad>
|
||||
|
||||
pts_angles = golden_spiral(
|
||||
from = 5,
|
||||
|
@@ -17,7 +17,7 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||
## Examples
|
||||
|
||||
use <golden_spiral_extrude.scad>;
|
||||
use <golden_spiral_extrude.scad>
|
||||
|
||||
shape_pts = [
|
||||
[2, -10],
|
||||
@@ -38,8 +38,8 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||

|
||||
|
||||
use <shape_circle.scad>;
|
||||
use <golden_spiral_extrude.scad>;
|
||||
use <shape_circle.scad>
|
||||
use <golden_spiral_extrude.scad>
|
||||
|
||||
$fn = 12;
|
||||
|
||||
|
@@ -12,9 +12,9 @@ If `lt` contains `elem`, this function returns `true`. If you want to test eleme
|
||||
|
||||
## Examples
|
||||
|
||||
use <voxel/vx_circle.scad>;
|
||||
use <util/sort.scad>;
|
||||
use <util/has.scad>;
|
||||
use <voxel/vx_circle.scad>
|
||||
use <util/sort.scad>
|
||||
use <util/has.scad>
|
||||
|
||||
pts = vx_circle(10);
|
||||
assert(has(pts, [2, -10]));
|
||||
|
@@ -21,14 +21,14 @@ This function maps keys to values. You can use the following to process the retu
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_len.scad>;
|
||||
use <util/map/hashmap_put.scad>;
|
||||
use <util/map/hashmap_get.scad>;
|
||||
use <util/map/hashmap_del.scad>;
|
||||
use <util/map/hashmap_keys.scad>;
|
||||
use <util/map/hashmap_values.scad>;
|
||||
use <util/map/hashmap_entries.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_len.scad>
|
||||
use <util/map/hashmap_put.scad>
|
||||
use <util/map/hashmap_get.scad>
|
||||
use <util/map/hashmap_del.scad>
|
||||
use <util/map/hashmap_keys.scad>
|
||||
use <util/map/hashmap_values.scad>
|
||||
use <util/map/hashmap_entries.scad>
|
||||
|
||||
m1 = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
assert(hashmap_len(m1) == 3);
|
||||
@@ -45,8 +45,8 @@ This function maps keys to values. You can use the following to process the retu
|
||||
|
||||
Want to simulate class-based OO in OpenSCAD? Here's my experiment.
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_get.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_get.scad>
|
||||
|
||||
function methods(mths) = hashmap(mths);
|
||||
function _(name, instance) = hashmap_get(instance, name);
|
||||
|
@@ -13,9 +13,9 @@ This function deletes the mapping for the specified key from a [util/map/hashmap
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_get.scad>;
|
||||
use <util/map/hashmap_del.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_get.scad>
|
||||
use <util/map/hashmap_del.scad>
|
||||
|
||||
m1 = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
m2 = hashmap_del(m1, "k1");
|
||||
|
@@ -10,8 +10,8 @@ Returns a list containing all `[key, value]`s in a [util/map/hashmap](https://op
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_entries.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_entries.scad>
|
||||
|
||||
m = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
echo(hashmap_entries(m)); // a list contains ["k1", 10], ["k2", 20], ["k3", 30]
|
||||
|
@@ -13,8 +13,8 @@ This function gets the value of the specified key from a [util/map/hashmap](http
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_get.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_get.scad>
|
||||
|
||||
m = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
assert(hashmap_get(m, "k2") == 20);
|
@@ -10,8 +10,8 @@ Returns a list containing all keys in a [util/map/hashmap](https://openhome.cc/e
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_keys.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_keys.scad>
|
||||
|
||||
m = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
|
||||
|
@@ -10,8 +10,8 @@ Returns the length of a [util/map/hashmap](https://openhome.cc/eGossip/OpenSCAD/
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_len.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_len.scad>
|
||||
|
||||
m = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
assert(hashmap_len(m) == 3);
|
@@ -14,9 +14,9 @@ Puts a key/value pair to a [util/map/hashmap](https://openhome.cc/eGossip/OpenSC
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_put.scad>;
|
||||
use <util/map/hashmap_get.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_put.scad>
|
||||
use <util/map/hashmap_get.scad>
|
||||
|
||||
m1 = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
|
||||
|
@@ -10,8 +10,8 @@ Returns a list containing all values in a [util/map/hashmap](https://openhome.cc
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/map/hashmap.scad>;
|
||||
use <util/map/hashmap_values.scad>;
|
||||
use <util/map/hashmap.scad>
|
||||
use <util/map/hashmap_values.scad>
|
||||
|
||||
m = hashmap([["k1", 10], ["k2", 20], ["k3", 30]]);
|
||||
|
||||
|
@@ -19,12 +19,12 @@ This function models the mathematical set, backed by a hash table. You can use t
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_add.scad>;
|
||||
use <util/set/hashset_has.scad>;
|
||||
use <util/set/hashset_del.scad>;
|
||||
use <util/set/hashset_len.scad>;
|
||||
use <util/set/hashset_elems.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_add.scad>
|
||||
use <util/set/hashset_has.scad>
|
||||
use <util/set/hashset_del.scad>
|
||||
use <util/set/hashset_len.scad>
|
||||
use <util/set/hashset_elems.scad>
|
||||
|
||||
s1 = hashset([1, 2, 3, 4, 5, 2, 3, 5]);
|
||||
assert(hashset_len(s1) == 5);
|
||||
|
@@ -13,9 +13,9 @@ This function adds an element to a [util/set/hashset](https://openhome.cc/eGossi
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_add.scad>;
|
||||
use <util/set/hashset_has.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_add.scad>
|
||||
use <util/set/hashset_has.scad>
|
||||
|
||||
s1 = hashset([1, 2, 3, 4, 5]);
|
||||
s2 = hashset_add(s1, 9);
|
||||
|
@@ -13,9 +13,9 @@ This function dels an element from a [util/set/hashset](https://openhome.cc/eGos
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_del.scad>;
|
||||
use <util/set/hashset_has.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_del.scad>
|
||||
use <util/set/hashset_has.scad>
|
||||
|
||||
s1 = hashset([1, 2, 3, 4, 5]);
|
||||
s2 = hashset_del(s1, 3);
|
||||
|
@@ -10,8 +10,8 @@ Returns a list containing all elements in a [util/set/hashset](https://openhome.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_elems.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_elems.scad>
|
||||
|
||||
s = hashset([1, 2, 3, 4, 5]);
|
||||
assert(hashset_elems(s) == [1, 2, 3, 4, 5]);
|
||||
|
@@ -13,8 +13,8 @@ Returns `true` if a [util/set/hashset](https://openhome.cc/eGossip/OpenSCAD/lib3
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_has.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_has.scad>
|
||||
|
||||
s = hashset([1, 2, 3, 4, 5]);
|
||||
assert(hashset_has(s, 3));
|
||||
|
@@ -10,8 +10,8 @@ Returns the length of the elements in a [util/set/hashset](https://openhome.cc/e
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/set/hashset.scad>;
|
||||
use <util/set/hashset_len.scad>;
|
||||
use <util/set/hashset.scad>
|
||||
use <util/set/hashset_len.scad>
|
||||
|
||||
s = hashset([1, 2, 3, 4, 5]);
|
||||
assert(hashset_len(s) == 5);
|
||||
|
@@ -13,8 +13,8 @@ Gets all points on the path of a spiral around a cylinder. Its `$fa`, `$fs` and
|
||||
|
||||
## Examples
|
||||
|
||||
use <helix.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <helix.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
$fn = 12;
|
||||
|
||||
@@ -36,8 +36,8 @@ Gets all points on the path of a spiral around a cylinder. Its `$fa`, `$fs` and
|
||||
|
||||

|
||||
|
||||
use <helix.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <helix.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
$fn = 12;
|
||||
|
||||
|
@@ -21,7 +21,7 @@ Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module.
|
||||
|
||||
## Examples
|
||||
|
||||
use <helix_extrude.scad>;
|
||||
use <helix_extrude.scad>
|
||||
|
||||
shape_pts = [
|
||||
[5, -2],
|
||||
@@ -43,7 +43,7 @@ Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module.
|
||||
|
||||

|
||||
|
||||
use <helix_extrude.scad>;
|
||||
use <helix_extrude.scad>
|
||||
|
||||
r1 = 40;
|
||||
r2 = 20;
|
||||
|
@@ -10,7 +10,7 @@ This module creates hexagons in a hexagon.
|
||||
|
||||
## Examples
|
||||
|
||||
use <hexagons.scad>;
|
||||
use <hexagons.scad>
|
||||
|
||||
radius = 20;
|
||||
spacing = 2;
|
||||
@@ -20,7 +20,7 @@ This module creates hexagons in a hexagon.
|
||||
|
||||

|
||||
|
||||
use <hexagons.scad>;
|
||||
use <hexagons.scad>
|
||||
|
||||
radius = 20;
|
||||
spacing = 2;
|
||||
|
@@ -8,7 +8,7 @@ Hollows out a 2D object.
|
||||
|
||||
## Examples
|
||||
|
||||
use <hollow_out.scad>;
|
||||
use <hollow_out.scad>
|
||||
|
||||
hollow_out(shell_thickness = 1)
|
||||
circle(r = 3, $fn = 48);
|
||||
|
@@ -12,7 +12,7 @@ Checks whether a point is on a line.
|
||||
|
||||
## Examples
|
||||
|
||||
use <in_polyline.scad>;
|
||||
use <in_polyline.scad>
|
||||
|
||||
pts = [
|
||||
[0, 0],
|
||||
@@ -27,7 +27,7 @@ Checks whether a point is on a line.
|
||||
|
||||
----
|
||||
|
||||
use <in_polyline.scad>;
|
||||
use <in_polyline.scad>
|
||||
|
||||
pts = [
|
||||
[10, 0, 10],
|
||||
|
@@ -13,8 +13,8 @@ Checks whether a point is inside a shape.
|
||||
|
||||
## Examples
|
||||
|
||||
use <shape_taiwan.scad>;
|
||||
use <in_shape.scad>;
|
||||
use <shape_taiwan.scad>
|
||||
use <in_shape.scad>
|
||||
|
||||
points = shape_taiwan(30);
|
||||
|
||||
|
@@ -17,7 +17,7 @@ Create a joint_T for rotatable models.
|
||||
|
||||
## Examples
|
||||
|
||||
use <part/joint_T.scad>;
|
||||
use <part/joint_T.scad>
|
||||
|
||||
$fn = 48;
|
||||
|
||||
|
@@ -12,6 +12,6 @@ Linear interpolate the vector v1 to v2.
|
||||
|
||||
## Examples
|
||||
|
||||
use <util/lerp.scad>;
|
||||
use <util/lerp.scad>
|
||||
|
||||
assert(lerp([0, 0, 0], [100, 100, 100], 0.5) == [50, 50, 50]);
|
@@ -13,7 +13,7 @@ Creates a line from two points. When the end points are `CAP_ROUND`, you can use
|
||||
|
||||
## Examples
|
||||
|
||||
use <line2d.scad>;
|
||||
use <line2d.scad>
|
||||
|
||||
$fn = 24;
|
||||
|
||||
|
@@ -13,7 +13,7 @@ Creates a 3D line from two points.
|
||||
|
||||
## Examples
|
||||
|
||||
use <line3d.scad>;
|
||||
use <line3d.scad>
|
||||
|
||||
line3d(
|
||||
p1 = [0, 0, 0],
|
||||
@@ -24,7 +24,7 @@ Creates a 3D line from two points.
|
||||
|
||||

|
||||
|
||||
use <line3d.scad>;
|
||||
use <line3d.scad>
|
||||
|
||||
line3d(
|
||||
p1 = [0, 0, 0],
|
||||
@@ -37,7 +37,7 @@ Creates a 3D line from two points.
|
||||
|
||||

|
||||
|
||||
use <line3d.scad>;
|
||||
use <line3d.scad>
|
||||
|
||||
line3d(
|
||||
p1 = [0, 0, 0],
|
||||
|
@@ -13,7 +13,7 @@ Find the intersection of two line segments. Return `[]` if lines don't intersect
|
||||
|
||||
## Examples
|
||||
|
||||
use <lines_intersection.scad>;
|
||||
use <lines_intersection.scad>
|
||||
|
||||
line1 = [[0, 0], [0, 10]];
|
||||
line2 = [[5, 0], [-5, 5]];
|
||||
|
@@ -11,10 +11,10 @@ When having uniform cross sections, you can use [sweep](https://openhome.cc/eGos
|
||||
|
||||
## Examples
|
||||
|
||||
use <shape_star.scad>;
|
||||
use <shape_circle.scad>;
|
||||
use <ptf/ptf_rotate.scad>;
|
||||
use <loft.scad>;
|
||||
use <shape_star.scad>
|
||||
use <shape_circle.scad>
|
||||
use <ptf/ptf_rotate.scad>
|
||||
use <loft.scad>
|
||||
|
||||
sects = [
|
||||
for(i = 10; i >= 4; i = i - 1)
|
||||
|
@@ -23,13 +23,14 @@
|
||||
- `start` : The starting point of the turtle. Default to `[0, 0]`.
|
||||
- `forward_chars` : Chars used for forwarding after the last iteration. Default to `'F'`.
|
||||
- `rule_prs` : The probabilities for taking rules. If each rule is chosen with a certain probability, it's a stochastic L-system. Each probability value for a rule ranges from 0 to 1.
|
||||
- `seed` : Optional. Seed value for random number generator for repeatable results. **Since:** 3.3.
|
||||
|
||||
## Examples
|
||||
|
||||
[lsystem2-collections.scad](https://github.com/JustinSDK/dotSCAD/blob/master/examples/turtle/lsystem2_collection.scad) collects several L-system grammars. Here's one of them.
|
||||
|
||||
use <turtle/lsystem2.scad>;
|
||||
use <line2d.scad>;
|
||||
use <turtle/lsystem2.scad>
|
||||
use <line2d.scad>
|
||||
|
||||
for(line = fern()) {
|
||||
line2d(
|
||||
@@ -56,8 +57,8 @@
|
||||
|
||||
// a stochastic L-system
|
||||
|
||||
use <turtle/lsystem2.scad>;
|
||||
use <line2d.scad>;
|
||||
use <turtle/lsystem2.scad>
|
||||
use <line2d.scad>
|
||||
|
||||
for(line = weed()) {
|
||||
line2d(
|
||||
|
@@ -27,13 +27,14 @@
|
||||
- `start` : The starting point of the turtle. Default to `[0, 0]`.
|
||||
- `forward_chars` : Chars used for forwarding after the last iteration. Default to `'F'`.
|
||||
- `rule_prs` : The probabilities for taking rules. If each rule is chosen with a certain probability, it's a stochastic L-system. Each probability value for a rule ranges from 0 to 1.
|
||||
- `seed` : Optional. Seed value for random number generator for repeatable results. **Since:** 3.3.
|
||||
|
||||
## Examples
|
||||
|
||||
[lsystem3-collections.scad](https://github.com/JustinSDK/dotSCAD/blob/master/examples/turtle/lsystem3_collection.scad) collects several L-system grammars. Here's one of them.
|
||||
|
||||
use <turtle/lsystem3.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <turtle/lsystem3.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
for(line = hilbert_curve()) {
|
||||
polyline_join([line[0], line[1]])
|
||||
@@ -56,8 +57,8 @@
|
||||
|
||||
// a stochastic L-system
|
||||
|
||||
use <turtle/lsystem3.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <turtle/lsystem3.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
for(line = vine()) {
|
||||
polyline_join([line[0], line[1]])
|
||||
|
@@ -10,7 +10,7 @@ It can calculate a determinant, a special number that can be calculated from a s
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_determinant.scad>;
|
||||
use <matrix/m_determinant.scad>
|
||||
|
||||
assert(
|
||||
m_determinant([
|
||||
|
@@ -10,7 +10,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to mirror
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_mirror.scad>;
|
||||
use <matrix/m_mirror.scad>
|
||||
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
32
docs/lib3x-m_replace.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# m_replace
|
||||
|
||||
It replaces the aᵢⱼ element of a matrix.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `m` : A matrix.
|
||||
- `i` : The i-th row.
|
||||
- `j` : The j-th column.
|
||||
- `value` : The new value.
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_replace.scad>
|
||||
|
||||
original_m = [
|
||||
[1, 2, 3, 4],
|
||||
[5, 6, 7, 8],
|
||||
[9, 10, 11, 12]
|
||||
];
|
||||
|
||||
expected = [
|
||||
[1, 2, 3, 4],
|
||||
[5, 6, 70, 8],
|
||||
[9, 10, 11, 12]
|
||||
];
|
||||
|
||||
actual = m_replace(original_m, 1, 2, 70);
|
||||
|
||||
assert(actual == expected);
|
@@ -11,7 +11,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_rotation.scad>;
|
||||
use <matrix/m_rotation.scad>
|
||||
|
||||
point = [20, 0, 0];
|
||||
a = [0, -45, 45];
|
||||
@@ -25,7 +25,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate
|
||||
|
||||

|
||||
|
||||
use <matrix/m_rotation.scad>;
|
||||
use <matrix/m_rotation.scad>
|
||||
|
||||
v = [10, 10, 10];
|
||||
|
||||
|
@@ -10,7 +10,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale i
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_scaling.scad>;
|
||||
use <matrix/m_scaling.scad>
|
||||
|
||||
cube(10);
|
||||
translate([15, 0, 0])
|
||||
|
@@ -12,7 +12,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear a
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_shearing.scad>;
|
||||
use <matrix/m_shearing.scad>
|
||||
|
||||
color("red") {
|
||||
multmatrix(m_shearing(sx = [1, 0]))
|
||||
|
@@ -10,7 +10,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to transla
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_translation.scad>;
|
||||
use <matrix/m_translation.scad>
|
||||
|
||||
cube(2, center = true);
|
||||
multmatrix(m_translation([5, 0, 0]))
|
||||
|
@@ -10,7 +10,7 @@ It transposes a matrix.
|
||||
|
||||
## Examples
|
||||
|
||||
use <matrix/m_transpose.scad>;
|
||||
use <matrix/m_transpose.scad>
|
||||
|
||||
original_m = [
|
||||
[1, 2, 3, 4],
|
||||
|
@@ -12,9 +12,9 @@ Given a 2D path, this function constructs a mid-point smoothed version by joinin
|
||||
|
||||
## Examples
|
||||
|
||||
use <polyline_join.scad>;
|
||||
use <shape_taiwan.scad>;
|
||||
use <midpt_smooth.scad>;
|
||||
use <polyline_join.scad>
|
||||
use <shape_taiwan.scad>
|
||||
use <midpt_smooth.scad>
|
||||
|
||||
taiwan = shape_taiwan(50);
|
||||
smoothed = midpt_smooth(taiwan, 20, true);
|
||||
|
@@ -9,7 +9,7 @@ Creates multi-line text from a list of strings. Parameters are the same as the b
|
||||
|
||||
## Examples
|
||||
|
||||
use <multi_line_text.scad>;
|
||||
use <multi_line_text.scad>
|
||||
|
||||
multi_line_text(
|
||||
["Welcome", "to", "Taiwan"],
|
||||
|
@@ -9,12 +9,13 @@ Creates a hamiltonian path from a maze. The path is the result of maze traversal
|
||||
- `rows` : The rows of a maze.
|
||||
- `columns` : The columns of a maze.
|
||||
- `start` : The start point to travel the maze. Default to `[0, 0]`.
|
||||
- `init_cells` : You can define your own initial cell data, a 2-dimension list of `[x, y, type, visited]`. `visited` means the cell is visited or not. A visited cell won't be visited when traveling the maze. If you don't provide `init_cells`, `mz_square` will generate one automatically. If you provide `init_cells`, `rows` and `columns` will be ignored. **Since:** 3.3
|
||||
- `seed` : The maze is traveling randomly. Use `seed` to initialize the pseudorandom number generator.
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_hamiltonian.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <maze/mz_hamiltonian.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
rows = 5;
|
||||
columns = 10;
|
||||
|
@@ -15,9 +15,9 @@ It's a helper for creating wall data from maze cells. You can transform wall poi
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_hex_walls.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <maze/mz_square_cells.scad>
|
||||
use <maze/mz_hex_walls.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
rows = 10;
|
||||
columns = 12;
|
||||
|
33
docs/lib3x-mz_hexwalls.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# mz_hexwalls
|
||||
|
||||
It's a helper for creating wall data from maze cells. You can transform wall points for creating different types of mazes.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cells` : Maze cells.
|
||||
- `cell_radius` : The radius of a cell.
|
||||
- `left_border` : Default to `true`. Create the leftmost border of the maze.
|
||||
- `bottom_border` : Default to `true`. Create the bottommost border of the maze.
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_square.scad>
|
||||
use <maze/mz_hexwalls.scad>
|
||||
use <polyline_join.scad>
|
||||
|
||||
rows = 10;
|
||||
columns = 12;
|
||||
cell_width = 5;
|
||||
wall_thickness = 2;
|
||||
|
||||
cells = mz_square(rows, columns);
|
||||
walls = mz_hexwalls(cells, cell_width);
|
||||
|
||||
for(wall = walls) {
|
||||
polyline_join(wall)
|
||||
circle(wall_thickness, $fn = 24);
|
||||
}
|
||||
|
||||

|
61
docs/lib3x-mz_square.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# mz_square
|
||||
|
||||
This function returns cell data of a square maze. The data is a 2-dimension list of cells. A cell has the data structure `[x, y, type]`. `x` and `y` are 0-based. `x` means the x-th column and `y` means y-th row for a cell. The value of `type` can be `0`, `1`, `2`, `3` or `4`. Setting them to constants is convenient.
|
||||
|
||||
NO_WALL = 0; // the cell has no wall
|
||||
TOP_WALL = 1; // the cell has a top wall
|
||||
RIGHT_WALL = 2; // the cell has a right wall
|
||||
TOP_RIGHT_WALL = 3; // the cell has a top wall and a right wall
|
||||
MASK = 4; // the cell is masked.
|
||||
|
||||
The cell data is seperated from views. You can use cell data to construct [different types of mazes](https://www.thingiverse.com/justinsdk/collections/maze-generator).
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `rows` : The number of rows.
|
||||
- `columns` : The number of columns.
|
||||
- `start` : The start point to travel the maze. Default to `[0, 0]`.
|
||||
- `init_cells` : You can define your own initial cell data, a 2-dimension list of `[x, y, type, visited]`. `visited` means the cell is visited or not. A visited cell won't be visited when traveling the maze. If you don't provide `init_cells`, `mz_square` will generate one automatically. If you provide `init_cells`, `rows` and `columns` will be ignored.
|
||||
- `x_wrapping` : Default to `false`. If you want to wrap the maze in the x direction, set it to `true`. The last column of cells will be adjacent to the first column of cells.
|
||||
- `y_wrapping` : Default to `false`. If you want to wrap the maze in the y direction, set it to `true`. The last row of cells will be adjacent to the first row of cells.
|
||||
- `seed` : The maze is traveling randomly. Use `seed` to initialize the pseudorandom number generator.
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_square.scad>
|
||||
use <line2d.scad>
|
||||
|
||||
rows = 10;
|
||||
columns = 10;
|
||||
cell_width = 5;
|
||||
wall_thickness = 2;
|
||||
|
||||
NO_WALL = 0;
|
||||
TOP_WALL = 1;
|
||||
RIGHT_WALL = 2;
|
||||
TOP_RIGHT_WALL = 3;
|
||||
MASK = 4;
|
||||
|
||||
cells = mz_square(rows, columns);
|
||||
|
||||
for(row = cells, cell = row) {
|
||||
type = cell[2];
|
||||
|
||||
translate([cell.x, cell.y] * cell_width) {
|
||||
if(type == TOP_WALL || type == TOP_RIGHT_WALL) {
|
||||
line2d([0, cell_width], [cell_width, cell_width], wall_thickness);
|
||||
}
|
||||
|
||||
if(type == RIGHT_WALL || type == TOP_RIGHT_WALL) {
|
||||
line2d([cell_width, cell_width], [cell_width, 0], wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
line2d([0, 0], [cell_width * columns, 0], wall_thickness);
|
||||
line2d([0, 0], [0, cell_width * rows], wall_thickness);
|
||||
|
||||

|
||||
|
@@ -24,8 +24,8 @@ The cell data is seperated from views. You can use cell data to construct [diffe
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <line2d.scad>;
|
||||
use <maze/mz_square_cells.scad>
|
||||
use <line2d.scad>
|
||||
|
||||
rows = 10;
|
||||
columns = 10;
|
||||
|