Compare commits
384 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
86f94d2499 | ||
|
6737b4a43e | ||
|
3dde9f2745 | ||
|
3ac4136043 | ||
|
70879d4c73 | ||
|
840f8df3ae | ||
|
49e13d920a | ||
|
948410ec56 | ||
|
8576d93dd8 | ||
|
47a3f9c155 | ||
|
93c7ea5c9d | ||
|
cfda38c8bd | ||
|
d3640830c4 | ||
|
dac87e49c5 | ||
|
843063db31 | ||
|
30c1e0fb13 | ||
|
8727bfbf8b | ||
|
c12e160e03 | ||
|
110bc5c400 | ||
|
8fdd195949 | ||
|
4c65e12a88 | ||
|
1816aad98e | ||
|
28e8a5c4b2 | ||
|
d849034bc7 | ||
|
2c1f8faa56 | ||
|
b998cc8f32 | ||
|
e126b1af1d | ||
|
b256bf7c90 | ||
|
3c830cc90d | ||
|
76b973d824 | ||
|
90c05523ce | ||
|
0cfa510874 | ||
|
9b6c17ace4 | ||
|
43f84ba478 | ||
|
8ee52bd672 | ||
|
dc5e063b25 | ||
|
aae8f688c0 | ||
|
60931ec8b9 | ||
|
5a15dd9fdb | ||
|
6bb3b445b4 | ||
|
66bb8ef643 | ||
|
4d02e6bb65 | ||
|
681d697840 | ||
|
8a8e28c61d | ||
|
55c2cd6fda | ||
|
273d32dc69 | ||
|
472d5c7ba7 | ||
|
eba7f63576 | ||
|
ec18d2eeeb | ||
|
51e5356f21 | ||
|
582050d096 | ||
|
b7d8d3e87c | ||
|
ed6ddec02c | ||
|
ab0504607d | ||
|
b3ae216b72 | ||
|
a6caaac787 | ||
|
f915b07289 | ||
|
1ff5d848d2 | ||
|
8de9c7f138 | ||
|
92c1667194 | ||
|
e26e6d7472 | ||
|
47b5b91b0a | ||
|
cda26241dd | ||
|
cfa0d211ed | ||
|
0a73460884 | ||
|
774229e3f9 | ||
|
b1c3e371a3 | ||
|
e45c16fe3f | ||
|
2b36c42c99 | ||
|
bec487baba | ||
|
ce0daaf6bc | ||
|
46c25aa51e | ||
|
f542661e2a | ||
|
172e1f8ceb | ||
|
31c6ee8599 | ||
|
d9199bf9ed | ||
|
3b57412108 | ||
|
fd684a10cb | ||
|
aa5fc938d0 | ||
|
ac1167eacc | ||
|
691a8f3ff9 | ||
|
e6280ad9f4 | ||
|
0c6744c62d | ||
|
6d858125c2 | ||
|
cad5623248 | ||
|
07fd4e47e3 | ||
|
108a232981 | ||
|
912adba419 | ||
|
53a69477d6 | ||
|
5f3bfb391d | ||
|
16509eec6c | ||
|
15a03b7fb2 | ||
|
deec59b408 | ||
|
8fa2de0a60 | ||
|
5d012ece48 | ||
|
b1687bece2 | ||
|
2d9562c8b6 | ||
|
c8e1244651 | ||
|
862fabcd3a | ||
|
1a28d90853 | ||
|
9d1804a4d1 | ||
|
502ef06db2 | ||
|
810f298c70 | ||
|
0408ec9cbe | ||
|
be05e3b68e | ||
|
65119984fd | ||
|
bdb4dace7f | ||
|
4aff538837 | ||
|
c0fb254c43 | ||
|
dd03a9f3db | ||
|
eca1d20c70 | ||
|
d9f065a734 | ||
|
a5d2c24ea1 | ||
|
aa12110504 | ||
|
8f0b40322e | ||
|
d4aaee1db9 | ||
|
ee89119f2f | ||
|
d1bd586bee | ||
|
f88b7bf8f3 | ||
|
fbd10cd25d | ||
|
dfe76bff78 | ||
|
d743f36086 | ||
|
f1eda43ac0 | ||
|
569171971b | ||
|
cb4b3e6685 | ||
|
eaed7ff34f | ||
|
2c00ef8525 | ||
|
17c62ba293 | ||
|
ae78c61491 | ||
|
e9b1e7f61f | ||
|
9ed4e1c42b | ||
|
72197670cb | ||
|
b9d88334c5 | ||
|
937b6a35bd | ||
|
5aec44eba8 | ||
|
2f6a170d2c | ||
|
5fff65c0d1 | ||
|
3aa5d552c0 | ||
|
631d0c8506 | ||
|
5d8abc1028 | ||
|
59ae810383 | ||
|
ccce2706f0 | ||
|
c680780d11 | ||
|
0d829b7185 | ||
|
e3706e1f87 | ||
|
9f1aa6a653 | ||
|
67a7d20880 | ||
|
7cc01a05c6 | ||
|
f9dd9deb53 | ||
|
a747bcff3a | ||
|
d94381dee2 | ||
|
8ef20b16e3 | ||
|
de1d0166e6 | ||
|
eb8305966d | ||
|
2d74627e45 | ||
|
945aeacdc4 | ||
|
17b731ad8f | ||
|
3830a2e523 | ||
|
62840eb510 | ||
|
d6021374ba | ||
|
43e5e66529 | ||
|
dde0156642 | ||
|
edabcb8f79 | ||
|
f7398f0d84 | ||
|
0f37651bc3 | ||
|
2df7a64ad7 | ||
|
0b4097fd09 | ||
|
0bad260d46 | ||
|
e414d2859b | ||
|
c9d0122779 | ||
|
daed828c9a | ||
|
8ceae06645 | ||
|
299b3869fd | ||
|
80fb650df4 | ||
|
919ae2f158 | ||
|
a851ee6bb7 | ||
|
340847cd19 | ||
|
5b21cc10d7 | ||
|
ab99a24352 | ||
|
f4696f231e | ||
|
218db7f7a8 | ||
|
bb8604e42b | ||
|
9182575ff2 | ||
|
ed9477ece5 | ||
|
56d2fb648f | ||
|
057ad863af | ||
|
002711ae3e | ||
|
8a5956e852 | ||
|
0eb1387f27 | ||
|
46dfe4ff25 | ||
|
323e81a82c | ||
|
61c6e9f70d | ||
|
2af270a8da | ||
|
c4c9831798 | ||
|
03ac58acaa | ||
|
2110b9cb31 | ||
|
93d7c0239d | ||
|
5a37620a5b | ||
|
8bc6a0b4c9 | ||
|
06831ffe15 | ||
|
df5775bd05 | ||
|
6f83a6192a | ||
|
85f8acdbee | ||
|
c75bf8bfee | ||
|
2d755a6cbf | ||
|
01fc0298f6 | ||
|
a07244fd47 | ||
|
e3443bf0e8 | ||
|
e2771ca01c | ||
|
643266f4a3 | ||
|
5a0a4a8fa4 | ||
|
78127faba6 | ||
|
d203fe4030 | ||
|
3be3a271e6 | ||
|
f5d813839b | ||
|
0a604c5793 | ||
|
f1a8d6f0dc | ||
|
af084fb043 | ||
|
0510b18516 | ||
|
78bfb2f31d | ||
|
e185e9b7e9 | ||
|
3fb08570c6 | ||
|
41db148815 | ||
|
beaebfcc37 | ||
|
6493eea0ac | ||
|
6299da9d23 | ||
|
e5850f871d | ||
|
85c75018f1 | ||
|
e84c7bc7a0 | ||
|
26db1cf25b | ||
|
f9d609087d | ||
|
14bbb3f205 | ||
|
3376b870a7 | ||
|
90d2f1ac9c | ||
|
fe8256ef0d | ||
|
7351e401c9 | ||
|
e26d1d3233 | ||
|
ad7819f1eb | ||
|
957e5ab5d5 | ||
|
0218724b48 | ||
|
8983b01b30 | ||
|
7c59a3e11b | ||
|
f433a79c31 | ||
|
700f46bfef | ||
|
e34bc73def | ||
|
cec42209f2 | ||
|
758b14715f | ||
|
f89794e3cc | ||
|
edd022bca2 | ||
|
c5c9ca40c9 | ||
|
423fc36f1c | ||
|
283b091c7c | ||
|
bf0601eaef | ||
|
8c4d2b5333 | ||
|
88b0868358 | ||
|
68ad185712 | ||
|
2e1def3556 | ||
|
9a2e66f999 | ||
|
e1985e85b0 | ||
|
c31145be3b | ||
|
fee00580be | ||
|
5a836b02d6 | ||
|
bec05fb5b4 | ||
|
15c1a98b8d | ||
|
e170918a5d | ||
|
5a7c13a548 | ||
|
f34f2e0bbf | ||
|
f47267c656 | ||
|
2e2079a323 | ||
|
627909fc9e | ||
|
fcddf7b187 | ||
|
eaeb0d1e28 | ||
|
6b64ca01ab | ||
|
df0f293825 | ||
|
37e272e333 | ||
|
799790932e | ||
|
a56d443686 | ||
|
d581e60678 | ||
|
d1ae9174a9 | ||
|
9d63c4ffeb | ||
|
db6c77a523 | ||
|
658fe213d6 | ||
|
184b0be7e8 | ||
|
e0874c5ca3 | ||
|
84f27c1ce3 | ||
|
2f8f51ad30 | ||
|
76bbb93724 | ||
|
f2f25fcc44 | ||
|
576470477a | ||
|
8f8e1f717a | ||
|
91d39de4a6 | ||
|
5e3d1ced28 | ||
|
1d812f8750 | ||
|
6854c86f90 | ||
|
ff63835009 | ||
|
f6a1050a01 | ||
|
aabc373798 | ||
|
e9e346cb51 | ||
|
810a1d3ece | ||
|
43a52bbaa0 | ||
|
fdefc03774 | ||
|
56d755ec06 | ||
|
b2abc0dde0 | ||
|
49398206de | ||
|
d2287ff119 | ||
|
731b4ff1ab | ||
|
bb45854f33 | ||
|
7648373e01 | ||
|
0e9710b8d4 | ||
|
69e6d24b08 | ||
|
47523ea95c | ||
|
99e91aafaa | ||
|
106be46e64 | ||
|
cc0e7499f9 | ||
|
840799f6cc | ||
|
10aed43d98 | ||
|
217878454a | ||
|
0b4d1e3840 | ||
|
dd90b4c106 | ||
|
ea39db6ca2 | ||
|
d904a0b629 | ||
|
eed652ee17 | ||
|
208fd1cb0f | ||
|
40280f6927 | ||
|
53cd4f3d4a | ||
|
31ce310080 | ||
|
46633f444a | ||
|
42d90d68ff | ||
|
8b70b3e2b4 | ||
|
59e9f97fa7 | ||
|
571ddccf5c | ||
|
68f2539726 | ||
|
b9518ad8ed | ||
|
944d63dc68 | ||
|
309a2086a3 | ||
|
b66c36fc55 | ||
|
31a2e1c54e | ||
|
80e296d9dc | ||
|
12b5df8a0f | ||
|
53f9583cf3 | ||
|
1401a00876 | ||
|
5dfb293702 | ||
|
2aca57c779 | ||
|
60dee6f872 | ||
|
c5ca8528d5 | ||
|
0cec181a0b | ||
|
b9a3d5c496 | ||
|
699de29c53 | ||
|
1f3022a3cc | ||
|
e081d03193 | ||
|
8f40ae8b30 | ||
|
afd460579e | ||
|
c0902b00cc | ||
|
a71b9fe174 | ||
|
90b2d542ef | ||
|
6a83c26e9b | ||
|
652f763c90 | ||
|
6babff457e | ||
|
429abba8ae | ||
|
561e2b69b1 | ||
|
7dbfbc3741 | ||
|
e0256a0925 | ||
|
599ffdb4ab | ||
|
00dfbd2366 | ||
|
d8027d45e2 | ||
|
a0f16c9cd6 | ||
|
04fd1590a7 | ||
|
4e1eca2df2 | ||
|
8457bd403c | ||
|
9f0693c3ae | ||
|
769894d1a3 | ||
|
3ec8d13a14 | ||
|
295ff73223 | ||
|
e20d104cc7 | ||
|
1fcf8b113f | ||
|
d771a88642 | ||
|
de31131741 | ||
|
944152d326 | ||
|
6d62ac0a11 | ||
|
9f2cb46427 | ||
|
5615800a56 | ||
|
90f860cbc7 | ||
|
6754d231fc | ||
|
e099ebd012 |
70
README.md
@@ -1,13 +1,15 @@
|
||||
# dotSCAD 1.2
|
||||
# dotSCAD 2.0
|
||||
|
||||
> Helpful modules and functions when playing OpenSCAD. Based on OpenSCAD 2015.03.
|
||||
> **Reduce the burden of 3D modeling in mathematics.**
|
||||
|
||||

|
||||

|
||||
|
||||
[](https://github.com/JustinSDK/lib-openscad/blob/master/LICENSE)
|
||||
|
||||
## Introduction
|
||||
|
||||
**dotSCAD 2.0 is based on OpenSCAD 2019.05.** For old versions, please use dotSCAD 1.3. You can download all versions from the [releases](https://github.com/JustinSDK/dotSCAD/releases).
|
||||
|
||||
OpenSCAD uses three library locations, the installation library, built-in library, and user defined libraries. It's convenient to set `OPENSCADPATH`. Check [Setting OPENSCADPATH](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Setting_OPENSCADPATH) in [OpenSCAD User Manual/Libraries](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries) for details.
|
||||
|
||||
Every module or function is located in the file which has the same name as the module or the function. For example, if you want to use the `line2d` module to draw a line, `include <line2d.scad>;` first.
|
||||
@@ -16,6 +18,16 @@ Every module or function is located in the file which has the same name as the m
|
||||
|
||||
line2d(p1 = [0, 0], p2 = [5, 0], width = 1);
|
||||
|
||||
Some module files are organized in a directory. For example, px_circle.scad exists in `pixel` directory. You have to prefix the directory name when including `px_circle`.
|
||||
|
||||
include <pixel/px_circle.scad>;
|
||||
points = px_circle(radius = 10);
|
||||
for(pt = points) {
|
||||
translate(pt) square(1);
|
||||
}
|
||||
|
||||
## Dependencies
|
||||
|
||||
Some modules depend on other modules. For example, the `polyline2d` module depends on the `line2d` module, so you also have to `include <line2d.scad>;` besides `include <polyline3d.scad>;`.
|
||||
|
||||
include <line2d.scad>;
|
||||
@@ -23,10 +35,12 @@ Some modules depend on other modules. For example, the `polyline2d` module depen
|
||||
|
||||
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1);
|
||||
|
||||
If OpenSCAD generates "WARNING: Ignoring unknown xxx function" or "WARNING: Ignoring unknown xxx module" when using one module of dotSCAD. Just try to `include <xxx.scad>;`.
|
||||
If OpenSCAD generates "WARNING: Ignoring unknown xxx function" or "WARNING: Ignoring unknown xxx module" when using one module of dotSCAD. Just try to `include <xxx.scad>;` or `include <dir/xxx.scad>` if xxx.scad exists in `dir` directory.
|
||||
|
||||
Too many dependencies? Because OpenSCAD doesn't provide namespace management, I personally think that exposing dependencies is better than hiding them. In this way, users can have their own way to manage dependencies. How to categorize dependencies is up to you. For example, you can include your commonly-used modules and functions in "commonly_used.scad" and then `include <commonly_used.scad>;` in the ".scad" file of your project.
|
||||
|
||||
**If you really don't want to care about dependencies, `include <dotSCAD.scad>;` or `use <dotSCAD.scad>;` come to save you.**
|
||||
|
||||
## Documentation
|
||||
|
||||
- 2D
|
||||
@@ -39,6 +53,7 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
||||
- [hexagons](https://openhome.cc/eGossip/OpenSCAD/lib-hexagons.html)
|
||||
- [polytransversals](https://openhome.cc/eGossip/OpenSCAD/lib-polytransversals.html)
|
||||
- [multi_line_text](https://openhome.cc/eGossip/OpenSCAD/lib-multi_line_text.html)
|
||||
- [voronoi2d](https://openhome.cc/eGossip/OpenSCAD/lib-voronoi2d.html)
|
||||
|
||||
- 3D
|
||||
- [rounded_cube](https://openhome.cc/eGossip/OpenSCAD/lib-rounded_cube.html)
|
||||
@@ -50,6 +65,7 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
||||
- [function_grapher](https://openhome.cc/eGossip/OpenSCAD/lib-function_grapher.html)
|
||||
- [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html)
|
||||
- [starburst](https://openhome.cc/eGossip/OpenSCAD/lib-starburst.html)
|
||||
- [voronoi3d](https://openhome.cc/eGossip/OpenSCAD/lib-voronoi3d.html)
|
||||
|
||||
- Transformation
|
||||
- [along_with](https://openhome.cc/eGossip/OpenSCAD/lib-along_with.html)
|
||||
@@ -59,13 +75,15 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
||||
|
||||
- Functon
|
||||
- [rotate_p](https://openhome.cc/eGossip/OpenSCAD/lib-rotate_p.html)
|
||||
- [sub_str](https://openhome.cc/eGossip/OpenSCAD/lib-sub_str.html)
|
||||
- [split_str](https://openhome.cc/eGossip/OpenSCAD/lib-split_str.html)
|
||||
- [parse_number](https://openhome.cc/eGossip/OpenSCAD/lib-parse_number.html)
|
||||
- [cross_sections](https://openhome.cc/eGossip/OpenSCAD/lib-cross_sections.html)
|
||||
- [paths2sections](https://openhome.cc/eGossip/OpenSCAD/lib-paths2sections.html)
|
||||
- [path_scaling_sections](https://openhome.cc/eGossip/OpenSCAD/lib-path_scaling_sections.html)
|
||||
- [path_scaling_sections](https://openhome.cc/eGossip/OpenSCAD/lib2-path_scaling_sections.html)
|
||||
- [bijection_offset](https://openhome.cc/eGossip/OpenSCAD/lib-bijection_offset.html)
|
||||
- [in_polyline](https://openhome.cc/eGossip/OpenSCAD/lib-in_polyline.html)
|
||||
- [in_shape](https://openhome.cc/eGossip/OpenSCAD/lib-in_shape.html)
|
||||
- [midpt_smooth](https://openhome.cc/eGossip/OpenSCAD/lib-midpt_smooth.html)
|
||||
- [trim_shape](https://openhome.cc/eGossip/OpenSCAD/lib-trim_shape.html)
|
||||
- [triangulate](https://openhome.cc/eGossip/OpenSCAD/lib-triangulate.html)
|
||||
|
||||
- Path
|
||||
- [arc_path](https://openhome.cc/eGossip/OpenSCAD/lib-arc_path.html)
|
||||
@@ -100,6 +118,7 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
||||
- [shape_path_extend](https://openhome.cc/eGossip/OpenSCAD/lib-shape_path_extend.html)
|
||||
|
||||
- 2D Shape Extrusion
|
||||
- [bend_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-bend_extrude.html)
|
||||
- [path_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-path_extrude.html)
|
||||
- [ring_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-ring_extrude.html)
|
||||
- [helix_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-helix_extrude.html)
|
||||
@@ -107,19 +126,34 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
||||
- [archimedean_spiral_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-archimedean_spiral_extrude.html)
|
||||
- [sphere_spiral_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-sphere_spiral_extrude.html)
|
||||
|
||||
- Utilities
|
||||
- [util/sub_str](https://openhome.cc/eGossip/OpenSCAD/lib2-sub_str.html)
|
||||
- [util/split_str](https://openhome.cc/eGossip/OpenSCAD/lib2-split_str.html)
|
||||
- [util/parse_number](https://openhome.cc/eGossip/OpenSCAD/lib2-parse_number.html)
|
||||
- [util/reverse](https://openhome.cc/eGossip/OpenSCAD/lib2-reverse.html)
|
||||
- [util/slice](https://openhome.cc/eGossip/OpenSCAD/lib2-slice.html)
|
||||
- [util/sort](https://openhome.cc/eGossip/OpenSCAD/lib2-sort.html)
|
||||
|
||||
- Matrix
|
||||
- [m_cumulate](https://openhome.cc/eGossip/OpenSCAD/lib-m_cumulate.html)
|
||||
- [m_translation](https://openhome.cc/eGossip/OpenSCAD/lib-m_translation.html)
|
||||
- [m_rotation](https://openhome.cc/eGossip/OpenSCAD/lib-m_rotation.html)
|
||||
- [m_scaling](https://openhome.cc/eGossip/OpenSCAD/lib-m_scaling.html)
|
||||
- [m_mirror](https://openhome.cc/eGossip/OpenSCAD/lib-m_mirror.html)
|
||||
- [m_shearing](https://openhome.cc/eGossip/OpenSCAD/lib-m_shearing.html)
|
||||
- [matrix/m_cumulate](https://openhome.cc/eGossip/OpenSCAD/lib2-m_cumulate.html)
|
||||
- [matrix/m_translation](https://openhome.cc/eGossip/OpenSCAD/lib2-m_translation.html)
|
||||
- [matrix/m_rotation](https://openhome.cc/eGossip/OpenSCAD/lib2-m_rotation.html)
|
||||
- [matrix/m_scaling](https://openhome.cc/eGossip/OpenSCAD/lib2-m_scaling.html)
|
||||
- [matrix/m_mirror](https://openhome.cc/eGossip/OpenSCAD/lib2-m_mirror.html)
|
||||
- [matrix/m_shearing](https://openhome.cc/eGossip/OpenSCAD/lib2-m_shearing.html)
|
||||
|
||||
- Other
|
||||
- [turtle2d](https://openhome.cc/eGossip/OpenSCAD/lib-turtle2d.html)
|
||||
- [turtle3d](https://openhome.cc/eGossip/OpenSCAD/lib-turtle3d.html)
|
||||
- [log](https://openhome.cc/eGossip/OpenSCAD/lib-log.html)
|
||||
- Turtle
|
||||
- [turtle/turtle2d](https://openhome.cc/eGossip/OpenSCAD/lib2-turtle2d.html)
|
||||
- [turtle/turtle3d](https://openhome.cc/eGossip/OpenSCAD/lib2-turtle3d.html)
|
||||
|
||||
- Pixel
|
||||
- [pixel/px_line](https://openhome.cc/eGossip/OpenSCAD/lib2-px_line.html)
|
||||
- [pixel/px_polyline](https://openhome.cc/eGossip/OpenSCAD/lib2-px_polyline.html)
|
||||
- [pixel/px_circle](https://openhome.cc/eGossip/OpenSCAD/lib2-px_circle.html)
|
||||
- [pixel/px_cylinder](https://openhome.cc/eGossip/OpenSCAD/lib2-px_cylinder.html)
|
||||
- [pixel/px_sphere](https://openhome.cc/eGossip/OpenSCAD/lib2-px_sphere.html)
|
||||
- [pixel/px_polygon](https://openhome.cc/eGossip/OpenSCAD/lib2-px_polygon.html)
|
||||
|
||||
## Bugs and Feedback
|
||||
|
||||
For bugs, questions and discussions please use the [Github Issues](https://github.com/JustinSDK/dotSCAD/issues).
|
||||
|
57
RELEASE.md
@@ -1,9 +1,59 @@
|
||||
> Version numbers are based on [Semantic Versioning](https://semver.org/).
|
||||
|
||||
# v1.2.1
|
||||
- Bugfixes
|
||||
- Fixed CCW faces when using `path_scaling_sections`.
|
||||
# v2.0
|
||||
- Use new features of OpenSCAD-2019.05 to refactor internal implementation.
|
||||
- Delete the `log` module which is never used.
|
||||
- Directory changed.
|
||||
- `m_cumulate`, `m_mirror`, `m_rotation`, `m_scaling`, `m_shearing` and `m_translation` are moved into the `matrix` directory.
|
||||
- `turtle2d` and `turtle3d` are moved into the `turtle` directory.
|
||||
- `parse_number`, `split_str` and `sub_str` are moved into the `util` directory.
|
||||
- New modules and functions.
|
||||
- [pixel/px_line](https://openhome.cc/eGossip/OpenSCAD/lib2-px_line.html)
|
||||
- [pixel/px_polyline](https://openhome.cc/eGossip/OpenSCAD/lib2-px_polyline.html)
|
||||
- [pixel/px_circle](https://openhome.cc/eGossip/OpenSCAD/lib2-px_circle.html)
|
||||
- [pixel/px_cylinder](https://openhome.cc/eGossip/OpenSCAD/lib2-px_cylinder.html)
|
||||
- [pixel/px_sphere](https://openhome.cc/eGossip/OpenSCAD/lib2-px_sphere.html)
|
||||
- [pixel/px_polygon](https://openhome.cc/eGossip/OpenSCAD/lib2-px_polygon.html)
|
||||
- [util/reverse](https://openhome.cc/eGossip/OpenSCAD/lib2-reverse.html)
|
||||
- [util/slice](https://openhome.cc/eGossip/OpenSCAD/lib2-slice.html)
|
||||
- [util/sort](https://openhome.cc/eGossip/OpenSCAD/lib2-sort.html)
|
||||
|
||||
# v1.3.3
|
||||
- Bugfixes
|
||||
- `in_shape`: Wrong variable name.
|
||||
|
||||
# v1.3.2
|
||||
- All-in-one source file.
|
||||
- You can use `include <dotSCAD.scad>;` or `use <dotSCAD.scad>;` if you really don't want to care about dependencies.
|
||||
|
||||
- Bugfixes
|
||||
- `along_with`: Wrong variable scope.
|
||||
|
||||
# v1.3.1
|
||||
- Bugfixes
|
||||
- `in_polyline`: Wrong parameter name.
|
||||
- `in_shape`: Missing dependency.
|
||||
- `along_with`: Avoid warning when using 2D points.
|
||||
|
||||
# v1.3
|
||||
- New modules:
|
||||
- [bend_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-bend_extrude.html)
|
||||
- [voronoi2d](https://openhome.cc/eGossip/OpenSCAD/lib-voronoi2d.html)
|
||||
- [voronoi3d](https://openhome.cc/eGossip/OpenSCAD/lib-voronoi3d.html)
|
||||
|
||||
- New functions:
|
||||
- [in_shape](https://openhome.cc/eGossip/OpenSCAD/lib-in_shape.html)
|
||||
- [in_polyline](https://openhome.cc/eGossip/OpenSCAD/lib-in_polyline.html)
|
||||
- [midpt_smooth](https://openhome.cc/eGossip/OpenSCAD/lib-midpt_smooth.html)
|
||||
- [trim_shape](https://openhome.cc/eGossip/OpenSCAD/lib-trim_shape.html)
|
||||
- [triangulate](https://openhome.cc/eGossip/OpenSCAD/lib-triangulate.html)
|
||||
|
||||
- New parameters:
|
||||
- `distance` of [shape_taiwan](https://openhome.cc/eGossip/OpenSCAD/lib-shape_taiwan.html)
|
||||
- `epsilon` of [bijection_offset](https://openhome.cc/eGossip/OpenSCAD/lib-bijection_offset.html)
|
||||
- `method` of [path_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-path_extrude.html)
|
||||
- `method` of [along_with](https://openhome.cc/eGossip/OpenSCAD/lib-along_with.html)
|
||||
|
||||
# v1.2
|
||||
- New modules and functions:
|
||||
- [starburst](https://openhome.cc/eGossip/OpenSCAD/lib-starburst.html)
|
||||
@@ -39,7 +89,6 @@
|
||||
- New Parameters:
|
||||
- added `v` parameter to [rotate_p](https://openhome.cc/eGossip/OpenSCAD/lib-rotate_p.html)
|
||||
|
||||
|
||||
- Improved Performance:
|
||||
- [path_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-path_extrude.html)
|
||||
- [align_with](https://openhome.cc/eGossip/OpenSCAD/lib-along_with.html)
|
||||
|
BIN
TaiwaneseBlackBear.JPG
Normal file
After Width: | Height: | Size: 68 KiB |
114
all/dotSCAD.scad
Normal file
@@ -0,0 +1,114 @@
|
||||
include <along_with.scad>;
|
||||
include <arc.scad>;
|
||||
include <arc_path.scad>;
|
||||
include <archimedean_spiral.scad>;
|
||||
include <archimedean_spiral_extrude.scad>;
|
||||
include <bend.scad>;
|
||||
include <bend_extrude.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <bezier_smooth.scad>;
|
||||
include <bezier_surface.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
include <box_extrude.scad>;
|
||||
include <circle_path.scad>;
|
||||
include <cross_sections.scad>;
|
||||
include <crystal_ball.scad>;
|
||||
include <ellipse_extrude.scad>;
|
||||
include <function_grapher.scad>;
|
||||
include <golden_spiral.scad>;
|
||||
include <golden_spiral_extrude.scad>;
|
||||
include <helix.scad>;
|
||||
include <helix_extrude.scad>;
|
||||
include <hexagons.scad>;
|
||||
include <hollow_out.scad>;
|
||||
include <hull_polyline2d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
include <in_polyline.scad>;
|
||||
include <in_shape.scad>;
|
||||
include <line2d.scad>;
|
||||
include <line3d.scad>;
|
||||
<<<<<<< HEAD
|
||||
include <log.scad>;
|
||||
include <m_cumulate.scad>;
|
||||
include <m_mirror.scad>;
|
||||
include <m_rotation.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_shearing.scad>;
|
||||
include <m_translation.scad>;
|
||||
include <midpt_smooth.scad>;
|
||||
include <multi_line_text.scad>;
|
||||
include <parse_number.scad>;
|
||||
=======
|
||||
include <midpt_smooth.scad>;
|
||||
include <multi_line_text.scad>;
|
||||
>>>>>>> v2
|
||||
include <path_extrude.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <paths2sections.scad>;
|
||||
include <pie.scad>;
|
||||
include <polyline2d.scad>;
|
||||
include <polyline3d.scad>;
|
||||
include <polysections.scad>;
|
||||
include <polytransversals.scad>;
|
||||
include <ring_extrude.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <rounded_cube.scad>;
|
||||
include <rounded_cylinder.scad>;
|
||||
include <rounded_extrude.scad>;
|
||||
include <rounded_square.scad>;
|
||||
include <shape_arc.scad>;
|
||||
include <shape_cyclicpolygon.scad>;
|
||||
include <shape_ellipse.scad>;
|
||||
include <shape_glued2circles.scad>;
|
||||
include <shape_path_extend.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
include <shape_pie.scad>;
|
||||
include <shape_square.scad>;
|
||||
include <shape_starburst.scad>;
|
||||
include <shape_superformula.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <shape_trapezium.scad>;
|
||||
include <shear.scad>;
|
||||
include <sphere_spiral.scad>;
|
||||
include <sphere_spiral_extrude.scad>;
|
||||
<<<<<<< HEAD
|
||||
include <split_str.scad>;
|
||||
include <starburst.scad>;
|
||||
include <stereographic_extrude.scad>;
|
||||
include <sub_str.scad>;
|
||||
include <torus_knot.scad>;
|
||||
include <triangulate.scad>;
|
||||
include <trim_shape.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle3d.scad>;
|
||||
include <voronoi2d.scad>;
|
||||
include <voronoi3d.scad>;
|
||||
=======
|
||||
include <starburst.scad>;
|
||||
include <stereographic_extrude.scad>;
|
||||
include <torus_knot.scad>;
|
||||
include <triangulate.scad>;
|
||||
include <trim_shape.scad>;
|
||||
include <voronoi2d.scad>;
|
||||
include <voronoi3d.scad>;
|
||||
include <util/parse_number.scad>;
|
||||
include <util/split_str.scad>;
|
||||
include <util/sub_str.scad>;
|
||||
include <util/reverse.scad>;
|
||||
include <util/slice.scad>;
|
||||
include <util/sort.scad>;
|
||||
include <matrix/m_cumulate.scad>;
|
||||
include <matrix/m_mirror.scad>;
|
||||
include <matrix/m_rotation.scad>;
|
||||
include <matrix/m_scaling.scad>;
|
||||
include <matrix/m_shearing.scad>;
|
||||
include <matrix/m_translation.scad>;
|
||||
include <turtle/turtle2d.scad>;
|
||||
include <turtle/turtle3d.scad>;
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <pixel/px_circle.scad>;
|
||||
include <pixel/px_cylinder.scad>;
|
||||
include <pixel/px_sphere.scad>;
|
||||
include <pixel/px_polygon.scad>;
|
||||
>>>>>>> v2
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 37 KiB |
BIN
docs/images/lib-bend_extrude-1.JPG
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
docs/images/lib-bend_extrude-2.JPG
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
docs/images/lib-circle_path-1.JPG
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/images/lib-in_shape-1.JPG
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/lib-midpt_smooth-1.JPG
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
docs/images/lib-path_extrude-4.JPG
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
docs/images/lib-path_extrude-5.JPG
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
docs/images/lib-path_extrude-6.JPG
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
docs/images/lib-path_extrude-7.JPG
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/lib-path_extrude-8.JPG
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/lib-path_extrude-9.JPG
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
docs/images/lib-polysections-3.JPG
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
docs/images/lib-polysections-4.JPG
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
docs/images/lib-triangulate-1.JPG
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
docs/images/lib-trim_shape-1.JPG
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
docs/images/lib-voronoi2d-1.JPG
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
docs/images/lib-voronoi2d-2.JPG
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
docs/images/lib-voronoi3d-1.JPG
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
docs/images/lib-voronoi3d-2.JPG
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
docs/images/lib2-px_circle-1.JPG
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/lib2-px_circle-2.JPG
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/images/lib2-px_cylinder-1.JPG
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
docs/images/lib2-px_cylinder-2.JPG
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
docs/images/lib2-px_line-1.JPG
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/images/lib2-px_line-2.JPG
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/lib2-px_polygon-1.JPG
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
docs/images/lib2-px_polyline-1.JPG
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
docs/images/lib2-px_polyline-2.JPG
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
docs/images/lib2-px_sphere-1.JPG
Normal file
After Width: | Height: | Size: 30 KiB |
@@ -5,9 +5,10 @@ Puts children along the given path. If there's only one child, it will put the c
|
||||
## Parameters
|
||||
|
||||
- `points` : The points along the path.
|
||||
- `angles` : Rotate before translate each child. If not given, rotate children automatically according to `points`.
|
||||
- `angles` : Rotate before translate each child. If not given, rotate children automatically according to `points` and `method`.
|
||||
- `twist` : If given, each child will be twisted before applying each element of `points` and `angles`.
|
||||
- `scale` : If given, each child will be scaled before applying each element of `points` and `angles`. It accepts a single value, `[sx, sy]` or `[sx, sy, sz]`.
|
||||
- `method` : Which method does `along_with` take to **guess** how to rotate children if `angles` is not specified? It accepts two value, `"AXIS_ANGLE"` (default) and `"EULER_ANGLE"`. See `path_extrude` for more information. **Since:** 1.3.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -19,7 +20,7 @@ Puts children along the given path. If there's only one child, it will put the c
|
||||
points = circle_path(radius = 50);
|
||||
|
||||
along_with(points)
|
||||
sphere(5, center = true);
|
||||
sphere(5);
|
||||
|
||||

|
||||
|
||||
|
@@ -6,6 +6,7 @@ Creates an arc. You can pass a 2 element vector to define the central angle. Its
|
||||
|
||||
- `radius` : The radius of the circle.
|
||||
- `angle` : A single value or a 2 element vector which defines the central angle. The first element of the vector is the beginning angle in degrees, and the second element is the ending angle.
|
||||
- `width` : The width of the arc.
|
||||
- `width_mode` : The default value is `"LINE_CROSS"`. The arc line will move outward by `width / 2` and inward by `width / 2`. If it's `"LINE_OUTWARD"`, The arc line moves outward by `width`. The `"LINE_INWARD"` moves the arc line inward by `width`.
|
||||
- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details.
|
||||
|
||||
|
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of an archimedean spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `rotate_p`, `archimedean_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -52,6 +52,4 @@ The arc shape is smoother if the `frags` value is larger.
|
||||
|
||||

|
||||
|
||||
This module is especially useful when you want to create things such as [zentangle bracelet](https://www.thingiverse.com/thing:1569263).
|
||||
|
||||
[](https://www.thingiverse.com/thing:1569263)
|
||||
This module is especially useful when you want to create things such as [PNG to pen holder](https://www.thingiverse.com/thing:1589493).
|
||||
|
36
docs/lib-bend_extrude.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# bend_extrude
|
||||
|
||||
The purpose of `bend_extrude` is to replace `bend` when you have a 2D shape. `bend_extrude` is faster and doesn't produce jagged edges.
|
||||
|
||||
**Since:** 1.3.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `size` : The size of a square which can contain the target shape.
|
||||
- `thickness` : The thinkness used to extrude the shape.
|
||||
- `angle` : The central angle of the arc shape. The radius of the arc is calculated automatically.
|
||||
- `frags` : Number of fragments. The target shape will be cut into `frags` fragments and recombined into an arc object. The default value is 24.
|
||||
|
||||
## Examples
|
||||
|
||||
The containing square of the target shape should be laid down on the x-y plane. For example.
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
|
||||
%square(size = [x, y]);
|
||||
text("A");
|
||||
|
||||

|
||||
|
||||
Once you have the size of the containing square, you can use it as the `size` argument of the `bend_extrude` module.
|
||||
|
||||
include <bend_extrude.scad>;
|
||||
|
||||
x = 9.25;
|
||||
y = 9.55;
|
||||
|
||||
bend_extrude(size = [x, y], thickness = 1, angle = 270)
|
||||
text("A");
|
||||
|
||||

|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a path, the `bezier_smooth` function uses bazier curves to smooth all corners. You can use it to create smooth lines or rounded shapes.
|
||||
|
||||
Dependencies: the `bezier_curve` function.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `path_pts` : A list of points represent the path.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
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.
|
||||
|
||||
It depends on the `bezier_curve` function so remember to include bezier_curve.scad.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t_step` : The distance between two points of the Bézier path.
|
||||
|
@@ -8,6 +8,7 @@ Move 2D outlines outward or inward by a given amount. Each point of the offsette
|
||||
|
||||
- `pts` : Points of a shape.
|
||||
- `d` : Amount to offset the shape. When negative, the shape is offset inwards.
|
||||
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001. **Since:** 1.3.
|
||||
|
||||
## Examples
|
||||
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a 2D shape, points and angles along the path, this function will return all cross-sections. Combined with the `polysections` module, you can create a specific path extrusion.
|
||||
|
||||
It depends on the `rotate_p` function. Remember to include "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts`: A list of points represent a shape. See the example below.
|
||||
|
@@ -4,8 +4,6 @@ Uses spherical coordinate system to create a crystal ball.
|
||||
|
||||

|
||||
|
||||
Dependencies: `rotate_p`, `cross_sections`, `polysections`, `ring_extrude`, `shape_pie`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radial distance r.
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Given a set 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)`.
|
||||
|
||||
It depends on the `line3d`, `polyline3d`, `hull_polyline3d` modules so you have to include "line3d.scad", "polyline3d.scad" and "hull_polyline3d.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A set of points `[x, y, f(x, y)]`. See examples below.
|
||||
|
@@ -4,8 +4,6 @@ Gets all points and angles on the path of a golden spiral based on Fibonacci num
|
||||
|
||||
It returns a vector of `[[x, y], angle]`.
|
||||
|
||||
Because of depending on `circle_path` and `rotate_p`, remember to include "circle_path.scad" and "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `from` : The nth Fibonacci number you wanna start from.
|
||||
|
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of a golden spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `circle_path`, `rotate_p`, `golden_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -6,8 +6,6 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||
Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module.
|
||||
|
||||
Dependencies: `helix`, `rotate_p`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
41
docs/lib-in_polyline.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# in_polyline
|
||||
|
||||
Checks wether a point is on a line.
|
||||
|
||||
**Since:** 1.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `line_pts` : The line points.
|
||||
- `pt` : The point to be checked.
|
||||
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
|
||||
|
||||
## Examples
|
||||
|
||||
include <in_polyline.scad>;
|
||||
|
||||
pts = [
|
||||
[0, 0],
|
||||
[10, 0],
|
||||
[10, 10]
|
||||
];
|
||||
|
||||
echo(in_polyline(pts, [-2, -3])); // false
|
||||
echo(in_polyline(pts, [5, 0])); // true
|
||||
echo(in_polyline(pts, [10, 5])); // true
|
||||
echo(in_polyline(pts, [10, 15])); // false
|
||||
|
||||
----
|
||||
|
||||
include <in_polyline.scad>;
|
||||
|
||||
pts = [
|
||||
[10, 0, 10],
|
||||
[20, 0, 10],
|
||||
[20, 10, 10]
|
||||
];
|
||||
|
||||
echo(in_polyline(pts, [10, 0, 10])); // true
|
||||
echo(in_polyline(pts, [15, 0, 10])); // true
|
||||
echo(in_polyline(pts, [15, 1, 10])); // false
|
||||
echo(in_polyline(pts, [20, 11, 10])); // false
|
39
docs/lib-in_shape.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# in_shape
|
||||
|
||||
Checks wether a point is inside a shape.
|
||||
|
||||
**Since:** 1.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shapt_pts` : The shape points.
|
||||
- `pt` : The point to be checked.
|
||||
- `include_edge` : If a point is on the edge of the shape, the function is default to return `false`. If `include_edge` is `true`, the function returns `true`.
|
||||
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
|
||||
|
||||
## Examples
|
||||
|
||||
include <shape_taiwan.scad>;
|
||||
include <in_shape.scad>;
|
||||
|
||||
points = shape_taiwan(30);
|
||||
|
||||
%polygon(points);
|
||||
|
||||
n = 200;
|
||||
xs = rands(-9, 9, n);
|
||||
ys = rands(-16, 16, n);
|
||||
|
||||
pts = [
|
||||
for(i = [0:n - 1])
|
||||
let(p = [xs[i], ys[i]])
|
||||
if(in_shape(points, p, true))
|
||||
p
|
||||
];
|
||||
|
||||
for(p = pts) {
|
||||
translate(p)
|
||||
circle(.2);
|
||||
}
|
||||
|
||||

|
@@ -1,46 +0,0 @@
|
||||
# log
|
||||
|
||||
A log module which supports simple level configurations and color titles.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `$log_level` : The accepted values are `"OFF"` (-1), `"INFO"` (20),
|
||||
`"WARNING"` (30), `"ERROR"` (40) or positive integers. The default value is `"INFO"`.
|
||||
- `level` : The accepted values are `"OFF"` (-1), `"INFO"` (20),
|
||||
`"WARNING"` (30), `"ERROR"` (40) or positive integers. If the value is greater or equal to `$log_level`, the `echo` message will display in the console.
|
||||
- `level_color` : Controls the color of level title. It accepts the same values as the CSS `color` property.
|
||||
|
||||
## Examples
|
||||
|
||||
include <log.scad>;
|
||||
|
||||
log()
|
||||
echo(" INFO message");
|
||||
|
||||
log("WARNING")
|
||||
echo(" WARNING message");
|
||||
|
||||
log("ERROR") {
|
||||
echo(" ERROR message 1");
|
||||
echo(" ERROR message 2");
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <log.scad>;
|
||||
|
||||
$log_level = "WARNING";
|
||||
|
||||
log()
|
||||
echo(" INFO message");
|
||||
|
||||
log("WARNING", "purple")
|
||||
echo(" WARNING message");
|
||||
|
||||
log("ERROR", "rgb(255, 100, 100)") {
|
||||
echo(" ERROR message 1");
|
||||
echo(" ERROR message 2");
|
||||
}
|
||||
|
||||

|
||||
|
23
docs/lib-m_mirror.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# m_mirror
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to mirror the child element on a plane through the origin.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `v` : The normal vector of a plane intersecting the origin through which to mirror the object.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_mirror.scad>;
|
||||
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||
multmatrix(m_mirror([1, 1, 0]))
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||

|
||||
|
@@ -1,25 +0,0 @@
|
||||
# m_multiply
|
||||
|
||||
Multiply two 4x4 transformation matrice.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `ma`, `mb` : Two 4x4 transformation matrice.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_multiply.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_rotation.scad>;
|
||||
|
||||
ma = m_scaling([0.5, 1, 2]);
|
||||
mb = m_rotation([0, 0, 90]);
|
||||
|
||||
cube(10);
|
||||
multmatrix(m_multiply(ma, mb))
|
||||
translate([15, 0, 0]) cube(10);
|
||||
|
||||

|
||||
|
26
docs/lib-midpt_smooth.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# midpt_smooth
|
||||
|
||||
Given a 2D path, this function constructs a mid-point smoothed version by joining the mid-points of the lines of the path.
|
||||
|
||||
**Since:** 1.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : The path points.
|
||||
- `n` : Perform mid-point smoothing n times.
|
||||
- `closed` : Is the points a 2D shape? If it's `true`, the function takes the last point and the first one to calculate a middle point. Default to `false`.
|
||||
|
||||
## Examples
|
||||
|
||||
include <hull_polyline2d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
include <midpt_smooth.scad>;
|
||||
|
||||
taiwan = shape_taiwan(50);
|
||||
smoothed = midpt_smooth(taiwan, 20, true);
|
||||
|
||||
translate([0, 0, 0]) hull_polyline2d(taiwan, .25);
|
||||
#translate([10, 0, 0]) hull_polyline2d(smoothed, .25);
|
||||
|
||||

|
@@ -1,16 +0,0 @@
|
||||
# parse_number
|
||||
|
||||
Parses the string argument as an number. It depends on the `split_str` and the `sub_str` functions so remember to include split_str.scad and sub_str.scad.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t` : A string containing the number representation to be parsed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <split_str.scad>;
|
||||
include <parse_number.scad>;
|
||||
|
||||
echo(parse_number("10") + 1); // ECHO: 11
|
||||
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
@@ -2,8 +2,6 @@
|
||||
|
||||
It extrudes a 2D shape along a path. This module is suitable for a path created by a continuous function.
|
||||
|
||||
It depends on the `rotate_p` function and the `polysections` module. Remember to include "rotate_p.scad" and "polysections.scad".
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
## Parameters
|
||||
@@ -13,7 +11,8 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
- `triangles` : `"SOLID"` (default), `"HOLLOW"` or user-defined indexes. See example below.
|
||||
- `twist` : The number of degrees of through which the shape is extruded.
|
||||
- `scale` : Scales the 2D shape by this value over the length of the extrusion. Scale can be a scalar or a vector.
|
||||
- `closed` : If the first point and the last point of `path_pts` has the same coordinate, setting `closed` to `true` will connect them automatically. You might have to set `twist` for connecting naturally.
|
||||
- `closed` : If the first point and the last point of `path_pts` has the same coordinate, setting `closed` to `true` will connect them automatically.
|
||||
- `method` : Which method does `path_extrude` take to **guess** how to generate sections? It accepts two value, `"AXIS_ANGLE"` (default) and `"EULER_ANGLE"`. **Since:** 1.3.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -123,6 +122,186 @@ When using this module, you should use points to represent the 2D shape. If your
|
||||
|
||||

|
||||
|
||||
## About `path_extrude` (Important!!)
|
||||
|
||||
**`path_extrude` is actually a workaround when you have/provide only path points.**
|
||||
|
||||
If you want to extrude a shape along a path precisely, providing enough information about how to rotate sections is necessary. If you want to extrude a shape along a helix, `helix_extrude` is more suitable because it knows how to dig out necessary data for rotating sections precisely.
|
||||
|
||||
include <helix.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <cross_sections.scad>;
|
||||
include <polysections.scad>;
|
||||
include <helix_extrude.scad>;
|
||||
|
||||
shape_pts = [
|
||||
[0,0],
|
||||
[3, 1],
|
||||
[0, 2]
|
||||
];
|
||||
|
||||
helix_extrude(shape_pts,
|
||||
radius = 5,
|
||||
levels = 5,
|
||||
level_dist = 3,
|
||||
vt_dir = "SPI_UP"
|
||||
);
|
||||
|
||||

|
||||
|
||||
If you have only points, what `path_extrude` can do is to **guess** data about rotations. The different algorithm will dig out different data. For example:
|
||||
|
||||
include <helix.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <helix.scad>;
|
||||
include <path_extrude.scad>;
|
||||
|
||||
shape_pts = [
|
||||
[0,0],
|
||||
[3, 1],
|
||||
[0, 2]
|
||||
];
|
||||
|
||||
points = helix(
|
||||
radius = 5,
|
||||
levels = 5,
|
||||
level_dist = 3,
|
||||
vt_dir = "SPI_UP"
|
||||
);
|
||||
|
||||
path_extrude(shape_pts, points);
|
||||
|
||||

|
||||
|
||||
You might think this is wrong. Actually, it's not. It's the correct/default behavior of `path_extrude`. Because **you don't provide other information**, what `path_extrude` can do is to **guess** how to generate sections from points. You think it's a bug in `path_extrude` because your brain has information that path points do not provide.
|
||||
|
||||
The `method` parameter is default to `"AXIS_ANGLE"`, a way to guess information from points. It accepts `"EULER_ANGLE"`, too.
|
||||
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <helix.scad>;
|
||||
include <path_extrude.scad>;
|
||||
|
||||
shape_pts = [
|
||||
[0,0],
|
||||
[3, 1],
|
||||
[0, 2]
|
||||
];
|
||||
|
||||
points = helix(
|
||||
radius = 5,
|
||||
levels = 5,
|
||||
level_dist = 3,
|
||||
vt_dir = "SPI_UP"
|
||||
);
|
||||
|
||||
path_extrude(shape_pts, points, method = "EULER_ANGLE");
|
||||
|
||||

|
||||
|
||||
`"EULER_ANGLE"` generates the same section at the same point. You might think the model is correct. But, that's because what it guesses from points just match your expectation.
|
||||
|
||||
`"EULER_ANGLE"` will generate an abrupt when the path is exactly vertical. [The problem happened in (older) Blender, too.](https://download.blender.org/documentation/htmlI/ch09s04.html)
|
||||
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <path_extrude.scad>;
|
||||
|
||||
shape_pts = [[5, -5], [5, 5], [-5, 5], [-5, -5]];
|
||||
|
||||
path_pts = [
|
||||
[20, 20, 0],
|
||||
[18.2, 18.2, 2],
|
||||
[16.8, 16.8, 4],
|
||||
[15.8, 15.8, 6],
|
||||
[15.2, 15.2, 8],
|
||||
[15, 15, 10],
|
||||
[15.2, 15.2, 12],
|
||||
[15.8, 15.8, 14],
|
||||
[16.8, 16.8, 16],
|
||||
[18.2, 18.2, 18],
|
||||
[20, 20, 20]
|
||||
];
|
||||
|
||||
path_extrude(shape_pts, path_pts, method = "EULER_ANGLE");
|
||||
|
||||

|
||||
|
||||
The problem doesn't happen when `method` is `"AXIS_ANGLE"`.
|
||||
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <path_extrude.scad>;
|
||||
|
||||
shape_pts = [[5, -5], [5, 5], [-5, 5], [-5, -5]];
|
||||
|
||||
path_pts = [
|
||||
[20, 20, 0],
|
||||
[18.2, 18.2, 2],
|
||||
[16.8, 16.8, 4],
|
||||
[15.8, 15.8, 6],
|
||||
[15.2, 15.2, 8],
|
||||
[15, 15, 10],
|
||||
[15.2, 15.2, 12],
|
||||
[15.8, 15.8, 14],
|
||||
[16.8, 16.8, 16],
|
||||
[18.2, 18.2, 18],
|
||||
[20, 20, 20]
|
||||
];
|
||||
|
||||
path_extrude(shape_pts, path_pts, method = "AXIS_ANGLE");
|
||||
|
||||

|
||||
|
||||
So, which is the correct method? Both methods are correct when you provide only points. `method` is just a way you tell `path_extrude` how to guess more information when extruding.
|
||||
|
||||
`"EULER_ANGLE"` will generate an abrupt when the path is exactly vertical. Some users might think it's a bug so `"AXIS_ANGLE"` is the default value.
|
||||
|
||||
`"EULER_ANGLE"`, however, generates the same section at the same point. This means that you don't have to adjust sections if you want to extrude along a closed path. It's an advantage when extruding. For example:
|
||||
|
||||
include <shape_pentagram.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <path_extrude.scad>;
|
||||
include <torus_knot.scad>;
|
||||
|
||||
p = 2;
|
||||
q = 3;
|
||||
phi_step = 0.05;
|
||||
star_radius = 0.5;
|
||||
|
||||
pts = torus_knot(p, q, phi_step);
|
||||
|
||||
shape_pentagram_pts = shape_pentagram(star_radius);
|
||||
|
||||
// not closed perfectly
|
||||
translate([-8, 0, 0]) path_extrude(
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
closed = true,
|
||||
method = "AXIS_ANGLE"
|
||||
);
|
||||
|
||||
// adjust it
|
||||
path_extrude(
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
closed = true,
|
||||
twist = 188,
|
||||
method = "AXIS_ANGLE"
|
||||
);
|
||||
|
||||
// "EULER_ANGLE" is easy in this situation
|
||||
translate([0, 8, 0]) path_extrude(
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
closed = true,
|
||||
method = "EULER_ANGLE"
|
||||
);
|
||||
|
||||

|
||||
|
||||
Both methods are useful. If `"AXIS_ANGLE"` doesn't guess out what you want, choose `"EULER_ANGLE"`, and vice versa.
|
||||
|
||||
For more information, see [#issue 3](https://github.com/JustinSDK/dotSCAD/issues/3) and [#issue 5](https://github.com/JustinSDK/dotSCAD/issues/5).
|
@@ -1,6 +1,6 @@
|
||||
# polyline2d
|
||||
|
||||
Creates a polyline from a list of `x`, `y` coordinates. When the end points are `CAP_ROUND`, you can use `$fa`, `$fs` or `$fn` to controll the circle module used internally. It depends on the `line2d` module so you have to `include` line2d.scad.
|
||||
Creates a polyline from a list of `x`, `y` coordinates. When the end points are `CAP_ROUND`, you can use `$fa`, `$fs` or `$fn` to controll the circle module used internally.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# polyline3d
|
||||
|
||||
Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `line3d` module so you have to `include` line3d.scad.
|
||||
Creates a polyline from a list of `[x, y, z]` coordinates.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -4,8 +4,6 @@ Rotational extrusion spins a 2D shape around the Z-axis. It's similar to the bui
|
||||
|
||||
Because we cannot retrieve the shape points of built-in 2D modules, it's necessary to provide `shapt_pts` and `triangles`.
|
||||
|
||||
This module depends on `rotate_p`, `cross_section` and `polysections`. Remember to include corresponding ".scad".
|
||||
|
||||
If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
## Parameters
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
Returns shape points of two glued circles. They can be used with xxx_extrude modules of dotSCAD. The shape points can be also used with the built-in polygon module.
|
||||
|
||||
Dependencies: `rotate_p`, `bezier_curve`, `shape_pie`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of two circles.
|
||||
|
@@ -4,8 +4,6 @@ It extends a 2D stroke along a path to create a 2D shape. This module is suitabl
|
||||
|
||||
When using this function, you should use points to represent the 2D stroke.
|
||||
|
||||
It depends on the `rotate_p` function. Remember to include "rotate_p.scad".
|
||||
|
||||
## Parameters
|
||||
|
||||
- `stroke_pts` : A list of points represent a stroke. See the example below.
|
||||
|
@@ -5,6 +5,7 @@ Returns shape points of [Taiwan](https://www.google.com.tw/maps?q=taiwan&um=1&ie
|
||||
## Parameters
|
||||
|
||||
- `h` : The height of Taiwan.
|
||||
- `distance` : Used for simplifying the shape. If the distance between a point and its previous points is not greater than `distance`, the point will be kept. Default to 0. **Since:** 1.3.
|
||||
|
||||
## Examples
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# sphere_spiral
|
||||
|
||||
Creates all points and angles on the path of a spiral around a sphere. It returns a vector of `[[x, y, z], [ax, ay, az]]`. `[x, y, z]` is actually obtained from rotating `[radius, 0, 0]` by `[ax, ay, az]`. It depends on the `rotate_p` function. Remember to include rotate_p.scad first.
|
||||
Creates all points and angles on the path of a spiral around a sphere. It returns a vector of `[[x, y, z], [ax, ay, az]]`. `[x, y, z]` is actually obtained from rotating `[radius, 0, 0]` by `[ax, ay, az]`.
|
||||
|
||||
## Parameters
|
||||
|
||||
|
@@ -4,8 +4,6 @@ Extrudes a 2D shape along the path of a sphere spiral.
|
||||
|
||||
When using this module, you should use points to represent the 2D shape. If your 2D shape is not solid, indexes of triangles are required. See [polysections](https://openhome.cc/eGossip/OpenSCAD/lib-polysections.html) for details.
|
||||
|
||||
Dependencies: `rotate_p`, `sphere_spiral`, `cross_sections`, `polysections`.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||
|
@@ -10,7 +10,7 @@ Generate a path of [The (p,q)-torus knot](https://en.wikipedia.org/wiki/Torus_kn
|
||||
|
||||
- `p` : The p parameter of The (p,q)-torus knot.
|
||||
- `q` : The q parameter of The (p,q)-torus knot.
|
||||
- `phi_step` : The amount when increasing phi.
|
||||
- `phi_step` : The amount when increasing phi.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -33,7 +33,7 @@ Generate a path of [The (p,q)-torus knot](https://en.wikipedia.org/wiki/Torus_kn
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
closed = true,
|
||||
twist = 188
|
||||
method = "EULER_ANGLE"
|
||||
);
|
||||
|
||||

|
||||
|
42
docs/lib-triangulate.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# triangulate
|
||||
|
||||
Given a 2D shape. This function performs a simple polygon triangulation algorithm and returns the indices of each triangle.
|
||||
|
||||
**Since:** 1.3.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : The shape points.
|
||||
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
|
||||
|
||||
## Examples
|
||||
|
||||
include <triangulate.scad>;
|
||||
|
||||
shape = [
|
||||
[0, 0],
|
||||
[10, 0],
|
||||
[12, 5],
|
||||
[5, 10],
|
||||
[10, 15],
|
||||
[0, 20],
|
||||
[-5, 18],
|
||||
[-18, 3],
|
||||
[-4, 10]
|
||||
];
|
||||
|
||||
tris = triangulate(shape);
|
||||
|
||||
difference() {
|
||||
polygon(shape);
|
||||
|
||||
for(tri = tris) {
|
||||
offset(-.2)
|
||||
polygon([for(idx = tri) shape[idx]]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||

|
||||
|
33
docs/lib-trim_shape.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# trim_shape
|
||||
|
||||
Given a tangled-edge shape. This function trims the shape to a non-tangled shape. It's intended to be a helper function after using `bijection_offset`.
|
||||
|
||||
**Since:** 1.3.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `shape_pts` : The shape points.
|
||||
- `from` : The index of the start point you want to trim.
|
||||
- `to` : The index of the last point you want to trim.
|
||||
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
|
||||
|
||||
## Examples
|
||||
|
||||
include <hull_polyline2d.scad>;
|
||||
include <trim_shape.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
include <midpt_smooth.scad>;
|
||||
|
||||
taiwan = shape_taiwan(50);
|
||||
offseted = bijection_offset(taiwan, -2);
|
||||
trimmed = trim_shape(offseted, 3, len(offseted) - 6);
|
||||
smoothed = midpt_smooth(trimmed, 3);
|
||||
|
||||
#hull_polyline2d(taiwan, .1);
|
||||
%translate([25, 0, 0])
|
||||
hull_polyline2d(offseted, .2);
|
||||
hull_polyline2d(smoothed, .1);
|
||||
|
||||

|
||||
|
47
docs/lib-voronoi2d.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# voronoi2d
|
||||
|
||||
Creats a [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram). The initial region for each cell is calculated automatically from the given points by the following code:
|
||||
|
||||
xs = [for(p = points) p[0]];
|
||||
ys = [for(p = points) abs(p[1])];
|
||||
region_size = max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]);
|
||||
|
||||
**Since:** 1.3.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : Points for each cell.
|
||||
- `spacing` : Distance between cells. Default to 1.
|
||||
- `r`, `delta`, `chamfer` : The outlines of each cell can be moved outward or inward. These parameters have the same effect as [`offset`](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#offset).
|
||||
- `region_type` : The initial shape for each cell can be `"square"` or `"circle"`. Default to `"square"`.
|
||||
|
||||
## Examples
|
||||
|
||||
include <voronoi2d.scad>;
|
||||
|
||||
xs = rands(-20, 20, 50);
|
||||
ys = rands(-20, 20, 50);
|
||||
|
||||
points = [for(i = [0:len(xs) - 1]) [xs[i], ys[i]]];
|
||||
|
||||
voronoi2d(points);
|
||||
translate([60, 0, 0])
|
||||
voronoi(points, region_type = "circle");
|
||||
|
||||

|
||||
|
||||
include <voronoi2d.scad>;
|
||||
include <hollow_out.scad>;
|
||||
|
||||
xs = rands(0, 40, 50);
|
||||
ys = rands(0, 20, 50);
|
||||
|
||||
points = [for(i = [0:len(xs) - 1]) [xs[i], ys[i]]];
|
||||
|
||||
difference() {
|
||||
square([40, 20]);
|
||||
voronoi2d(points);
|
||||
}
|
||||
hollow_out(shell_thickness = 1) square([40, 20]);
|
||||
|
||||

|
60
docs/lib-voronoi3d.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# voronoi3d
|
||||
|
||||
Creats a 3D version of [Voronoi diagram](https://en.wikipedia.org/wiki/Voronoi_diagram). The initial space for each cell is calculated automatically from the given points by the following code:
|
||||
|
||||
xs = [for(p = points) p[0]];
|
||||
ys = [for(p = points) abs(p[1])];
|
||||
zs = [for(p = points) abs(p[2])];
|
||||
space_size = max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2, (max(zs) - min(zs)) / 2]);
|
||||
// cube([space_size, space_size * 2, space_size * 2]);
|
||||
|
||||
The preview or rendering of 3D Voronoi is slow. If you want to use this module, render and export the 3D Voronoi model first. Then, `import` the model to do what you want.
|
||||
|
||||
**Since:** 1.3.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : Points for each cell.
|
||||
- `spacing` : Distance between cells. Default to 1.
|
||||
|
||||
## Examples
|
||||
|
||||
include <voronoi3d.scad>;
|
||||
|
||||
r = 30;
|
||||
|
||||
zas = rands(0, 359, 12);
|
||||
yas = rands(0, 179, 12);
|
||||
|
||||
points = [
|
||||
for(i = [0:len(zas) - 1])
|
||||
[
|
||||
r * cos(yas[i]) * cos(zas[i]),
|
||||
r * cos(yas[i]) * sin(zas[i]),
|
||||
r * sin(yas[i])
|
||||
]
|
||||
];
|
||||
|
||||
#for(pt = points) {
|
||||
translate(pt) cube(1);
|
||||
}
|
||||
|
||||
intersection() {
|
||||
sphere(r);
|
||||
voronoi3d(points);
|
||||
}
|
||||
|
||||

|
||||
|
||||
If you render, export and save the previous model as `voronoi3d.stl`, the following code will generate a Voronoi sphere.
|
||||
|
||||
r = 30;
|
||||
thickness = 2;
|
||||
|
||||
difference() {
|
||||
sphere(r);
|
||||
scale(1.01) import("voronoi3d.stl");
|
||||
sphere(r - thickness);
|
||||
}
|
||||
|
||||

|
@@ -6,14 +6,16 @@ The power of using transformation matrice is that you can cumulate all transform
|
||||
|
||||
## Parameters
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
- `matrice` : A list of 4x4 transformation matrice.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_rotation.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_translation.scad>;
|
||||
include <m_cumulate.scad>
|
||||
include <matrix/m_rotation.scad>;
|
||||
include <matrix/m_scaling.scad>;
|
||||
include <matrix/m_translation.scad>;
|
||||
include <matrix/m_cumulate.scad>
|
||||
|
||||
m = m_cumulate([
|
||||
m_translation([10, 20, 10]), m_scaling(2), m_rotation(60)]
|
25
docs/lib2-m_mirror.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# m_mirror
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to mirror the child element on a plane through the origin.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `v` : The normal vector of a plane intersecting the origin through which to mirror the object.
|
||||
|
||||
## Examples
|
||||
|
||||
include <matrix/m_mirror.scad>;
|
||||
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||
multmatrix(m_mirror([1, 1, 0]))
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||

|
||||
|
@@ -1,5 +1,7 @@
|
||||
# m_rotation
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate the child element about the axis of the coordinate system or around an arbitrary axis.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -11,7 +13,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_rotation.scad>;
|
||||
include <matrix/m_rotation.scad>;
|
||||
|
||||
point = [20, 0, 0];
|
||||
a = [0, -45, 45];
|
@@ -1,5 +1,7 @@
|
||||
# m_scaling
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale its child elements using the specified vector.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -10,7 +12,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale i
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_scaling.scad>;
|
||||
include <matrix/m_scaling.scad>;
|
||||
|
||||
cube(10);
|
||||
translate([15, 0, 0])
|
@@ -1,5 +1,7 @@
|
||||
# m_shearing
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear all child elements along the X-axis, Y-axis, or Z-axis in 3D.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -12,7 +14,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear a
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_shearing.scad>;
|
||||
include <matrix/m_shearing.scad>;
|
||||
|
||||
color("red") {
|
||||
multmatrix(m_shearing(sx = [1, 0]))
|
@@ -1,5 +1,7 @@
|
||||
# m_translation
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to translates (moves) its child elements along the specified vector.
|
||||
|
||||
**Since:** 1.1
|
||||
@@ -10,11 +12,11 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to transla
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_translation.scad>;
|
||||
include <matrix/m_translation.scad>;
|
||||
|
||||
cube(2, center = true);
|
||||
multmatrix(m_translation([5, 0, 0]))
|
||||
sphere(1,center = true);
|
||||
sphere(1);
|
||||
|
||||

|
||||
|
18
docs/lib2-parse_number.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# parse_number
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
Parses the string argument as an number.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `t` : A string containing the number representation to be parsed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/sub_str.scad>;
|
||||
include <util/split_str.scad>;
|
||||
include <util/parse_number.scad>;
|
||||
|
||||
echo(parse_number("10") + 1); // ECHO: 11
|
||||
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
@@ -18,7 +18,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
|
||||
taiwan = shape_taiwan(100);
|
||||
@@ -42,7 +41,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
|
||||
@@ -67,7 +65,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <rotate_p.scad>;
|
||||
@@ -105,7 +102,6 @@ You can use any point as the first point of the edge path. Just remember that yo
|
||||
include <hull_polyline3d.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <polysections.scad>;
|
||||
include <rotate_p.scad>;
|
||||
|
32
docs/lib2-px_circle.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# px_circle
|
||||
|
||||
Returns points that can be used to draw a pixel-style circle.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The circle radius. The value must be an integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled circle.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_circle.scad>;
|
||||
|
||||
for(pt = px_circle(10)) {
|
||||
translate(pt)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_circle.scad>;
|
||||
|
||||
for(pt = px_circle(10, filled = true)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
33
docs/lib2-px_cylinder.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# px_cylinder
|
||||
|
||||
Returns points that can be used to draw a pixel-style cylinder.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of the cylinder. It also accepts a vector `[r1, r2]`. `r1` is the bottom radius and `r2` is the top radius of a cone. Values must be an integer.
|
||||
- `h` : The height of the cylinder or cone.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled cylinder.
|
||||
- `thickness`: Default to 1. The thickness when `filled` is `false`. The value must be an integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_cylinder.scad>;
|
||||
|
||||
for(pt = px_cylinder([10, 15], 10)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_cylinder.scad>;
|
||||
|
||||
for(pt = px_cylinder([20, 15], h = 10, thickness = 3)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
31
docs/lib2-px_line.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# px_line
|
||||
|
||||
Given two points. `px_line` returns points that can be used to draw a pixel-style line.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `p1` : The start point `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
- `p2` : The end point `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
|
||||
for(pt = px_line([-10, 0], [20, 50])) {
|
||||
translate(pt)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
|
||||
for(pt = px_line([-10, 0, -10], [20, 50, 10])) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
39
docs/lib2-px_polygon.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# px_polygon
|
||||
|
||||
Returns points that can be used to draw a pixel-style polygon.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of points. Each point can be `[x, y]`. x, y must be integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled polygon.
|
||||
|
||||
## Examples
|
||||
|
||||
include <in_shape.scad>;
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <pixel/px_polygon.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
|
||||
pentagram = [
|
||||
for(pt = shape_pentagram(15))
|
||||
[round(pt[0]), round(pt[1])]
|
||||
];
|
||||
|
||||
for(pt = px_polygon(pentagram)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||
translate([30, 0])
|
||||
for(pt = px_polygon(pentagram, filled = true)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
55
docs/lib2-px_polyline.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# px_polyline
|
||||
|
||||
Given a list of points. `px_polyline` returns points that can be used to draw a pixel-style polyline.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : A list of points. Each point can be `[x, y]` or `[x, y, z]`. x, y, z must be integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
|
||||
pentagram = [
|
||||
for(pt = shape_pentagram(15))
|
||||
[round(pt[0]), round(pt[1])]
|
||||
];
|
||||
|
||||
for(pt = px_polyline(concat(pentagram, [pentagram[0]]))) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||

|
||||
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <sphere_spiral.scad>;
|
||||
|
||||
points_angles = sphere_spiral(
|
||||
radius = 20,
|
||||
za_step = 5
|
||||
);
|
||||
|
||||
points = [
|
||||
for(pa = points_angles)
|
||||
let(pt = pa[0])
|
||||
[round(pt[0]), round(pt[1]), round(pt[2])]
|
||||
];
|
||||
|
||||
for(a = [0:30:330]) {
|
||||
rotate(a)
|
||||
for(pt = px_polyline(points)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
}
|
||||
|
||||

|
||||
|
22
docs/lib2-px_sphere.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# px_sphere
|
||||
|
||||
Returns points that can be used to draw a pixel-style sphere.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `radius` : The radius of the sphere. The value must be an integer.
|
||||
- `filled` : Default to `false`. Set it `true` if you want a filled sphere.
|
||||
- `thickness`: Default to 1. The thickness when `filled` is `false`. The value must be an integer.
|
||||
|
||||
## Examples
|
||||
|
||||
include <pixel/px_sphere.scad>;
|
||||
|
||||
for(pt = px_sphere(10)) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
|
||||

|
16
docs/lib2-reverse.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# reverse
|
||||
|
||||
Reverse a list.
|
||||
|
||||
**Since: **: 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The list to be reversed.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/reverse.scad>;
|
||||
|
||||
echo(reverse([1, 2, 3])); // ECHO: [3, 2, 1]
|
||||
|
18
docs/lib2-slice.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# slice
|
||||
|
||||
Returns a list selected from `begin` to `end`, or to the `end` of the list (`end` not included).
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The original list.
|
||||
- `begin` : The beginning index, inclusive.
|
||||
- `end` : The ending index, exclusive. If it's omitted, the list begins with the character at the specified `begin` and extends to the end of the original list.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/slice.scad>;
|
||||
|
||||
echo(slice([for(c = "helloworld") c], 0, 5)); // ECHO: ["h", "e", "l", "l", "o"]
|
||||
echo(slice([for(c = "helloworld") c], 5)); // ECHO: ["w", "o", "r", "l", "d"]
|
32
docs/lib2-sort.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# sort
|
||||
|
||||
Sorts the elements of a list in ascending order. The list is a list-of-list construct, such as `[[a0, a1, a2...], [b0, b1, b2,...], [c0, c1, c2,...],...]`. When sorting, the function looks only at one index position of each sublist.
|
||||
|
||||
**Since:** 2.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `lt` : The original list.
|
||||
- `by` : Can be `"x"`、`"y"`、`"z"`, or `"idx"` (Default).
|
||||
- `idx` : When `by` is `"idx"`, the value of `idx` is used. The Default value is 0.
|
||||
|
||||
## Examples
|
||||
|
||||
include <util/sort.scad>;
|
||||
|
||||
assert(
|
||||
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]] ==
|
||||
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]])
|
||||
);
|
||||
|
||||
assert(
|
||||
[[2, 0, 0], [5, 0, 0], [7, 0, 0], [9, 0, 0], [10, 0, 0]] ==
|
||||
sort([[10, 0, 0], [5, 0, 0], [7, 0, 0], [2, 0, 0], [9, 0, 0]], by = "x")
|
||||
);
|
||||
|
||||
assert(
|
||||
[[0, 2, 0], [0, 5, 0], [0, 7, 0], [0, 9, 0], [0, 10, 0]] ==
|
||||
sort([[0, 10, 0], [0, 5, 0], [0, 7, 0], [0, 2, 0], [0, 9, 0]], by = "idx", idx = 1)
|
||||
);
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# split_str
|
||||
|
||||
Splits the given string around matches of the given delimiting character. It depeneds on the `sub_str` function so remember to `include <sub_str.scad>`.
|
||||
The dir changed since 2.0.
|
||||
|
||||
Splits the given string around matches of the given delimiting character.
|
||||
|
||||
## Parameters
|
||||
|
||||
@@ -9,8 +11,8 @@ Splits the given string around matches of the given delimiting character. It dep
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <split_str.scad>;
|
||||
include <util/sub_str.scad>;
|
||||
include <util/split_str.scad>;
|
||||
|
||||
echo(split_str("hello,world", ",")); // ECHO: ["hello", "world"]
|
||||
|
@@ -1,6 +1,8 @@
|
||||
# sub_str
|
||||
|
||||
Returns a new string that is a substring of the given string.
|
||||
The dir changed since 2.0.
|
||||
|
||||
Returns the part of the string from `begin` to `end`, or to the `end` of the string (`end` not included).
|
||||
|
||||
## Parameters
|
||||
|
||||
@@ -10,7 +12,7 @@ Returns a new string that is a substring of the given string.
|
||||
|
||||
## Examples
|
||||
|
||||
include <sub_str.scad>;
|
||||
include <util/sub_str.scad>;
|
||||
|
||||
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
||||
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
@@ -1,5 +1,7 @@
|
||||
# turtle2d
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can get the cooridinate `[x, y]` or `angle` of its current position.
|
||||
|
||||
## Parameters
|
||||
@@ -16,7 +18,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
||||
## Examples
|
||||
|
||||
include <line2d.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle/turtle2d.scad>;
|
||||
|
||||
module turtle_spiral(t_before, times, side_leng, angle, width) {
|
||||
$fn = 24;
|
||||
@@ -47,7 +49,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
||||

|
||||
|
||||
include <line2d.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle/turtle2d.scad>;
|
||||
|
||||
module turtle_spiral(t_before, side_leng, d_step, min_leng, angle, width) {
|
||||
$fn = 24;
|
@@ -1,11 +1,11 @@
|
||||
# turtle3d
|
||||
|
||||
The dir changed since 2.0.
|
||||
|
||||
An OpenSCAD implementation of 3D Turtle Graphics. When using the function, imagine that you are sitting on the turtle. You move or turn the turtle from the your viewpoint, not the viewpoint of OpenSCAD coordinates.
|
||||
|
||||
For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/OpenSCAD/3DTurtleGraphics.html).
|
||||
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cmd` : A string command. Different commands use different numbers of arguments.
|
||||
@@ -17,7 +17,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op
|
||||
|
||||
## Examples
|
||||
|
||||
include <turtle3d.scad>;
|
||||
include <turtle/turtle3d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
|
||||
leng = 10;
|
||||
@@ -47,7 +47,7 @@ For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/Op
|
||||
|
||||

|
||||
|
||||
include <turtle3d.scad>;
|
||||
include <turtle/turtle3d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
|
||||
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
47
examples/TaiwaneseBlackBear.scad
Normal file
@@ -0,0 +1,47 @@
|
||||
include <in_shape.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <pixel/px_sphere.scad>;
|
||||
include <pixel/px_cylinder.scad>;
|
||||
include <pixel/px_polygon.scad>;
|
||||
|
||||
module blocks(points) {
|
||||
for(pt = points) {
|
||||
translate(pt)
|
||||
cube(1, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
// Well, quick and dirty!!
|
||||
color("MediumSeaGreen")
|
||||
translate([3, -5, -27])
|
||||
for(pt = px_polygon([for(p = shape_taiwan(92, distance = 1)) [round(p[0]), round(p[1])]], filled = true)) {
|
||||
translate(pt)
|
||||
linear_extrude(1, scale = 0.5)
|
||||
square(1, center = true);
|
||||
}
|
||||
|
||||
color(c = [0.3, 0.3, 0.3]) {
|
||||
blocks(px_sphere(10));
|
||||
translate([7, 0, 9]) blocks(px_sphere(3));
|
||||
translate([-7, 0, 9]) blocks(px_sphere(3));
|
||||
translate([0, 0, -13]) blocks(px_sphere(12));
|
||||
translate([6, 0, -26]) blocks(px_cylinder([3, 4], 6));
|
||||
translate([-6, 0, -26]) blocks(px_cylinder([3, 4], 6))
|
||||
translate([10, 0, -13]) cube([6, 5, 10], center = true);
|
||||
translate([-10, 0, -13]) cube([6, 5, 10], center = true);
|
||||
}
|
||||
color("white") {
|
||||
translate([3, -7, 2]) blocks(px_sphere(2));
|
||||
translate([-3, -7, 2]) blocks(px_sphere(2));
|
||||
translate([0, -7, 0]) blocks(px_sphere(3));
|
||||
translate([0, -9, -4]) blocks(px_sphere(1));
|
||||
blocks(px_polyline([[0, -12, -10], [5, -9, -7], [8, -6, -6]]));
|
||||
blocks(px_polyline([[0, -12, -10], [5, -9, -8], [8, -6, -7]]));
|
||||
blocks(px_polyline([[0, -12, -10], [5, -9, -9], [8, -6, -8]]));
|
||||
blocks(px_polyline([[0, -12, -10], [5, -9, -9], [8, -6, -8]]));
|
||||
blocks(px_polyline([[0, -12, -10], [-5, -9, -7], [-8, -6, -6]]));
|
||||
blocks(px_polyline([[0, -12, -10], [-5, -9, -8], [-8, -6, -7]]));
|
||||
blocks(px_polyline([[0, -12, -10], [-5, -9, -9], [-8, -6, -8]]));
|
||||
}
|
69
examples/dancing_taiwan.scad
Normal file
@@ -0,0 +1,69 @@
|
||||
include <trim_shape.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <polysections.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
|
||||
x1 = 4; // [-20:4]
|
||||
x2 = 3; // [-20:4]
|
||||
x3 = 4; // [-20:4]
|
||||
y1 = 20;
|
||||
y2 = 40;
|
||||
y3 = 90;
|
||||
twist = -90;
|
||||
t_step = 0.1;
|
||||
|
||||
module dancing_formosan(x1, x2, x3, y1, y2, y3, twist, t_step) {
|
||||
|
||||
function cal_sections(shapt_pts, edge_path, twist) =
|
||||
let(
|
||||
sects = path_scaling_sections(shapt_pts, edge_path),
|
||||
leng = len(sects),
|
||||
twist_step = twist / leng
|
||||
)
|
||||
[
|
||||
for(i = [0:leng - 1])
|
||||
[
|
||||
for(p = sects[i])
|
||||
rotate_p(p, twist_step * i)
|
||||
]
|
||||
];
|
||||
|
||||
taiwan = shape_taiwan(100, 0.6);
|
||||
fst_pt = [13, 0, 0];
|
||||
|
||||
edge_path = bezier_curve(t_step, [
|
||||
fst_pt,
|
||||
fst_pt + [0, 0, 10],
|
||||
fst_pt + [x1, 0, y1],
|
||||
fst_pt + [x2, 0, 35],
|
||||
fst_pt + [x3, 0, y2],
|
||||
fst_pt + [0, 0, 55],
|
||||
fst_pt + [0, 0, y3]
|
||||
]);
|
||||
|
||||
|
||||
offseted = bijection_offset(taiwan, -2);
|
||||
|
||||
edge_path2 = [for(p = edge_path) p + [-2, 0, 0]];
|
||||
taiwan2 = trim_shape(offseted, 1, len(offseted) - 4);
|
||||
|
||||
sections = cal_sections(taiwan, edge_path, twist);
|
||||
sections2 = cal_sections(taiwan2, edge_path2, twist);
|
||||
|
||||
difference() {
|
||||
polysections(sections);
|
||||
polysections(sections2);
|
||||
}
|
||||
|
||||
translate([0, 0, -2])
|
||||
linear_extrude(2)
|
||||
rotate(twist - twist / len(sections))
|
||||
polygon(taiwan);
|
||||
|
||||
}
|
||||
|
||||
dancing_formosan(x1, x2, x3, y1, y2, y3, twist, t_step);
|
||||
|
126
examples/klein_bottle.scad
Normal file
@@ -0,0 +1,126 @@
|
||||
include <polysections.scad>;
|
||||
include <arc_path.scad>;
|
||||
include <circle_path.scad>;
|
||||
include <path_extrude.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <polyline2d.scad>;
|
||||
include <line2d.scad>;
|
||||
include <rotate_p.scad>;
|
||||
|
||||
radius1 = 10;
|
||||
radius2 = 20;
|
||||
bottom_height = 60;
|
||||
thickness = 1.5;
|
||||
t_step = 0.025;
|
||||
fn = 24;
|
||||
cut = false; // [true,false]
|
||||
|
||||
module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
|
||||
$fn = fn;
|
||||
|
||||
module bottom() {
|
||||
rotate(180) rotate_extrude() {
|
||||
|
||||
|
||||
translate([radius1 + radius2, 0, 0])
|
||||
polyline2d(
|
||||
arc_path(radius = radius2, angle = [180, 360])
|
||||
,thickness
|
||||
);
|
||||
|
||||
polyline2d(
|
||||
bezier_curve(t_step, [
|
||||
[radius1 + radius2 * 2, 0, 0],
|
||||
[radius1 + radius2 * 2, bottom_height * 0.25, 0],
|
||||
[radius1 + radius2 * 0.5, bottom_height * 0.5, 0],
|
||||
[radius1, bottom_height * 0.75, 0],
|
||||
[radius1, bottom_height, 0]
|
||||
]),
|
||||
thickness
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module tube() {
|
||||
|
||||
mid_pts = [
|
||||
[0, 0, bottom_height + radius1],
|
||||
[0, 0, bottom_height + radius1 * 2],
|
||||
[0, radius1, bottom_height + radius1 * 3],
|
||||
[0, radius1 * 2, bottom_height + radius1 * 3],
|
||||
[0, radius1 * 3, bottom_height + radius1 * 3],
|
||||
[0, radius1 * 4, bottom_height + radius1 * 2],
|
||||
[0, radius1 * 4, bottom_height + radius1],
|
||||
[0, radius1 * 4, bottom_height],
|
||||
[0, radius1 * 3, bottom_height - radius1],
|
||||
[0, radius1 * 2, bottom_height - radius1 * 2],
|
||||
[0, radius1, bottom_height + thickness / 2 - radius1 * 3],
|
||||
[0, 0, bottom_height - radius1 * 4],
|
||||
[0, 0, bottom_height - radius1 * 5]
|
||||
];
|
||||
|
||||
tube_path = bezier_curve(
|
||||
t_step,
|
||||
concat(
|
||||
concat([[0, 0, bottom_height]], mid_pts),
|
||||
[[0, 0, 0]]
|
||||
)
|
||||
);
|
||||
|
||||
tube_path2 = bezier_curve(
|
||||
t_step,
|
||||
concat(
|
||||
concat([[0, 0, bottom_height - thickness]], mid_pts),
|
||||
[[0, 0, -thickness] ]
|
||||
)
|
||||
);
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
bottom();
|
||||
|
||||
path_extrude(
|
||||
circle_path(radius1 + thickness / 2),
|
||||
tube_path
|
||||
);
|
||||
}
|
||||
|
||||
path_extrude(
|
||||
circle_path(radius1 - thickness / 2),
|
||||
tube_path2
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tube();
|
||||
}
|
||||
|
||||
module cutted_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
|
||||
difference() {
|
||||
union() {
|
||||
translate([radius2 + thickness, 0, 0])
|
||||
rotate([0, 90, 0]) klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn);
|
||||
translate([-radius2 - thickness, 0, 0])
|
||||
rotate([0, -90, 0]) klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
h = (radius1 + radius2) * 2;
|
||||
w = 2 * h;
|
||||
l = bottom_height * 4;
|
||||
translate([0, 0, h / 2])
|
||||
cube([l, w, h], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
if(cut) {
|
||||
cutted_klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn);
|
||||
} else {
|
||||
klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
21
examples/knot.scad
Normal file
@@ -0,0 +1,21 @@
|
||||
include <shape_pentagram.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <polysections.scad>;
|
||||
include <path_extrude.scad>;
|
||||
include <torus_knot.scad>;
|
||||
|
||||
p = 2;
|
||||
q = 3;
|
||||
phi_step = 0.05;
|
||||
star_radius = 0.5;
|
||||
|
||||
pts = torus_knot(p, q, phi_step);
|
||||
|
||||
shape_pentagram_pts = shape_pentagram(star_radius);
|
||||
|
||||
path_extrude(
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
closed = true,
|
||||
method = "EULER_ANGLE"
|
||||
);
|
44
examples/pixel_vase.scad
Normal file
@@ -0,0 +1,44 @@
|
||||
include <bezier_curve.scad>;
|
||||
include <pixel/px_line.scad>;
|
||||
include <pixel/px_polyline.scad>;
|
||||
include <pixel/px_cylinder.scad>;
|
||||
|
||||
x1 = 5;
|
||||
x2 = 20;
|
||||
x3 = 8;
|
||||
thickness = 1;
|
||||
|
||||
module pixel_vase(x1, x2, x3, thickness) {
|
||||
p0 = [x1, 0, 0];
|
||||
p1 = [10, 0, 4];
|
||||
p2 = [x2, 0, 8];
|
||||
p3 = [3, 0, 20];
|
||||
p4 = [x3, 0, 30];
|
||||
|
||||
rounded_points = [for(pt = bezier_curve(0.1,
|
||||
[p0, p1, p2, p3, p4]
|
||||
)) [round(pt[0]), round(pt[1]), round(pt[2])]];
|
||||
|
||||
px_path = px_polyline(rounded_points);
|
||||
leng = len(px_path);
|
||||
|
||||
for(p = px_cylinder(px_path[0][0], 1, true)) {
|
||||
linear_extrude(1) union() {
|
||||
translate([p[0], p[1]])
|
||||
square(1.1, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
for(i = [0:leng - 1]) {
|
||||
r = px_path[i][0];
|
||||
for(p = px_cylinder(r, 1, thickness = thickness)) {
|
||||
translate([0, 0, i])
|
||||
linear_extrude(1) union() {
|
||||
translate([p[0], p[1]])
|
||||
square(1.1, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pixel_vase(x1, x2, x3, thickness);
|
25
examples/stereographic_projection.scad
Normal file
@@ -0,0 +1,25 @@
|
||||
include <stereographic_extrude.scad>;
|
||||
|
||||
rows = 8;
|
||||
line_width = 15;
|
||||
block_width = 50;
|
||||
|
||||
module grid(rows, block_width, line_width) {
|
||||
half_side_length = (block_width * rows + line_width) / 2;
|
||||
|
||||
translate([-half_side_length, -half_side_length])
|
||||
for(i = [0:rows]) {
|
||||
translate([0, i * block_width, 0])
|
||||
square([block_width * rows, line_width]);
|
||||
|
||||
translate([i * block_width, 0, 0])
|
||||
square([line_width, block_width * rows + line_width]);
|
||||
}
|
||||
}
|
||||
|
||||
stereographic_extrude(block_width * rows + line_width, $fn = 48)
|
||||
grid(rows, block_width, line_width);
|
||||
|
||||
if($preview) {
|
||||
color("black") grid(rows, block_width, line_width);
|
||||
}
|
72
examples/superformula_vase.scad
Normal file
@@ -0,0 +1,72 @@
|
||||
include <trim_shape.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <polysections.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
include <shape_superformula.scad>;
|
||||
|
||||
/* [Superformula] */
|
||||
phi_step = 0.025;
|
||||
m = 8;
|
||||
n = 5;
|
||||
n3 = 8;
|
||||
|
||||
/* [Offset] */
|
||||
d = 0.1;
|
||||
|
||||
/* [Curve] */
|
||||
r1 = 1;
|
||||
r2 = 2;
|
||||
h1 = 5;
|
||||
h2 = 8;
|
||||
t_step = 0.025;
|
||||
twist = 90;
|
||||
|
||||
module superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist) {
|
||||
|
||||
function cal_sections(shapt_pts, edge_path, twist) =
|
||||
let(
|
||||
sects = path_scaling_sections(shapt_pts, edge_path),
|
||||
leng = len(sects),
|
||||
twist_step = twist / leng
|
||||
)
|
||||
[
|
||||
for(i = [0:leng - 1])
|
||||
[
|
||||
for(p = sects[i])
|
||||
rotate_p(p, twist_step * i)
|
||||
]
|
||||
];
|
||||
|
||||
superformula = shape_superformula(phi_step, m, m, n, n, n3);
|
||||
|
||||
edge_path = bezier_curve(t_step, [
|
||||
[1, 0, 0],
|
||||
[4, 0, 3],
|
||||
[2, 0, 4],
|
||||
[r1, 0, h1],
|
||||
[1, 0, 6],
|
||||
[r2, 0, h2],
|
||||
]);
|
||||
|
||||
offseted = bijection_offset(superformula, d);
|
||||
|
||||
edge_path2 = [for(p = edge_path) p + [d, 0, 0]];
|
||||
superformula2 = trim_shape(offseted, 3, len(offseted) - 1, epsilon = 0.0001);
|
||||
|
||||
sections = cal_sections(superformula, edge_path, twist);
|
||||
outer_sections = cal_sections(superformula2, edge_path2, twist);
|
||||
|
||||
difference() {
|
||||
polysections(outer_sections);
|
||||
polysections(sections);
|
||||
}
|
||||
|
||||
linear_extrude(d)
|
||||
rotate(twist - twist / len(sections))
|
||||
polygon(superformula2);
|
||||
}
|
||||
|
||||
superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist);
|
||||
|
58
examples/text_sphere.scad
Normal file
@@ -0,0 +1,58 @@
|
||||
include <rotate_p.scad>;
|
||||
include <sphere_spiral.scad>;
|
||||
include <cross_sections.scad>;
|
||||
include <polysections.scad>;
|
||||
include <sphere_spiral_extrude.scad>;
|
||||
|
||||
tx = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989";
|
||||
font_name = "Liberation Sans:style=Bold Italic";
|
||||
thickness = 2;
|
||||
|
||||
module text_sphere(tx, font_name, thickness) {
|
||||
$fn = 24;
|
||||
radius = 40;
|
||||
za_step = 360 / $fn;
|
||||
z_circles = 48;
|
||||
begin_angle = 720;
|
||||
end_angle = 630;
|
||||
|
||||
half_thickness = thickness / 2;
|
||||
|
||||
points_angles = sphere_spiral(
|
||||
radius = radius,
|
||||
za_step = za_step,
|
||||
z_circles = z_circles,
|
||||
begin_angle = begin_angle,
|
||||
end_angle = end_angle
|
||||
);
|
||||
|
||||
rotate(-180 / $fn) sphere_spiral_extrude(
|
||||
[
|
||||
[thickness, half_thickness],
|
||||
[-half_thickness, half_thickness],
|
||||
[-half_thickness, -half_thickness],
|
||||
[thickness, -half_thickness]
|
||||
],
|
||||
radius = radius,
|
||||
za_step = za_step,
|
||||
z_circles = z_circles,
|
||||
begin_angle = begin_angle,
|
||||
end_angle = end_angle
|
||||
);
|
||||
|
||||
|
||||
for(i = [0:len(points_angles) - 1]) {
|
||||
pa = points_angles[i];
|
||||
translate(pa[0]) rotate(pa[1] + [0, 8, 0])
|
||||
rotate([90, 0, 90])
|
||||
linear_extrude(half_thickness)
|
||||
translate([0, -10, 0])
|
||||
text(tx[i], font = font_name, halign = "center");
|
||||
}
|
||||
|
||||
translate([0, 0, -radius])
|
||||
linear_extrude(thickness * 2.5)
|
||||
circle(radius / 2);
|
||||
}
|
||||
|
||||
text_sphere(tx, font_name, thickness);
|
61
examples/text_tower.scad
Normal file
@@ -0,0 +1,61 @@
|
||||
include <helix.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <cross_sections.scad>;
|
||||
include <polysections.scad>;
|
||||
include <helix_extrude.scad>;
|
||||
|
||||
tx = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989";
|
||||
font_name = "Liberation Sans:style=Bold Italic";
|
||||
radius = 60;
|
||||
height = 150;
|
||||
thickness = 2;
|
||||
|
||||
module text_tower(tx, font_name, radius, height, thickness) {
|
||||
|
||||
font_size = 2 * PI * radius / $fn;
|
||||
angle_step = 360 / $fn;
|
||||
half_angle_step = angle_step / 2;
|
||||
half_thickness = thickness / 2;
|
||||
|
||||
module body() {
|
||||
points = helix(
|
||||
radius = radius,
|
||||
levels = height / font_size,
|
||||
level_dist = font_size,
|
||||
vt_dir = "SPI_DOWN"
|
||||
);
|
||||
for(i = [0:len(points) - 1]) {
|
||||
translate(points[i])
|
||||
rotate([90, 0, 90 + angle_step * i])
|
||||
linear_extrude(thickness, center = true)
|
||||
text(
|
||||
tx[i],
|
||||
font = font_name,
|
||||
size = font_size,
|
||||
halign = "center"
|
||||
);
|
||||
}
|
||||
|
||||
rotate(-half_angle_step)
|
||||
helix_extrude(
|
||||
[
|
||||
[thickness, half_thickness],
|
||||
[-thickness, half_thickness],
|
||||
[-thickness, -half_thickness],
|
||||
[thickness, -half_thickness]
|
||||
],
|
||||
radius = radius,
|
||||
levels = height / font_size + 1,
|
||||
level_dist = font_size,
|
||||
vt_dir = "SPI_DOWN"
|
||||
);
|
||||
}
|
||||
|
||||
translate([0, 0, -font_size - half_thickness])
|
||||
body();
|
||||
rotate(-half_angle_step)
|
||||
translate([0, 0, -font_size - thickness])
|
||||
cylinder(h = font_size, r = radius + thickness);
|
||||
}
|
||||
|
||||
text_tower(tx, font_name, radius, height, thickness, $fn = 24);
|