Compare commits
275 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 | ||
|
2d755a6cbf | ||
|
01fc0298f6 | ||
|
a07244fd47 | ||
|
e3443bf0e8 | ||
|
643266f4a3 | ||
|
5a0a4a8fa4 | ||
|
78127faba6 | ||
|
d203fe4030 | ||
|
3be3a271e6 | ||
|
f5d813839b | ||
|
0a604c5793 | ||
|
f1a8d6f0dc | ||
|
af084fb043 | ||
|
0510b18516 | ||
|
78bfb2f31d | ||
|
e185e9b7e9 | ||
|
3fb08570c6 | ||
|
41db148815 | ||
|
beaebfcc37 | ||
|
6493eea0ac | ||
|
6299da9d23 | ||
|
e5850f871d | ||
|
85c75018f1 | ||
|
e84c7bc7a0 | ||
|
f9d609087d | ||
|
14bbb3f205 | ||
|
3376b870a7 | ||
|
90d2f1ac9c | ||
|
fe8256ef0d | ||
|
7351e401c9 | ||
|
e26d1d3233 | ||
|
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 |
62
README.md
@@ -1,13 +1,15 @@
|
|||||||
# dotSCAD 1.3
|
# dotSCAD 2.0
|
||||||
|
|
||||||
> Reduce the burden of 3D modeling in mathematics. Compatible with OpenSCAD 2015.03 or laters.
|
> **Reduce the burden of 3D modeling in mathematics.**
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://github.com/JustinSDK/lib-openscad/blob/master/LICENSE)
|
[](https://github.com/JustinSDK/lib-openscad/blob/master/LICENSE)
|
||||||
|
|
||||||
## Introduction
|
## 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.
|
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.
|
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);
|
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>;`.
|
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>;
|
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);
|
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.
|
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
|
## Documentation
|
||||||
|
|
||||||
- 2D
|
- 2D
|
||||||
@@ -61,12 +75,9 @@ Too many dependencies? Because OpenSCAD doesn't provide namespace management, I
|
|||||||
|
|
||||||
- Functon
|
- Functon
|
||||||
- [rotate_p](https://openhome.cc/eGossip/OpenSCAD/lib-rotate_p.html)
|
- [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)
|
- [cross_sections](https://openhome.cc/eGossip/OpenSCAD/lib-cross_sections.html)
|
||||||
- [paths2sections](https://openhome.cc/eGossip/OpenSCAD/lib-paths2sections.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)
|
- [bijection_offset](https://openhome.cc/eGossip/OpenSCAD/lib-bijection_offset.html)
|
||||||
- [in_polyline](https://openhome.cc/eGossip/OpenSCAD/lib-in_polyline.html)
|
- [in_polyline](https://openhome.cc/eGossip/OpenSCAD/lib-in_polyline.html)
|
||||||
- [in_shape](https://openhome.cc/eGossip/OpenSCAD/lib-in_shape.html)
|
- [in_shape](https://openhome.cc/eGossip/OpenSCAD/lib-in_shape.html)
|
||||||
@@ -115,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)
|
- [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)
|
- [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
|
- Matrix
|
||||||
- [m_cumulate](https://openhome.cc/eGossip/OpenSCAD/lib-m_cumulate.html)
|
- [matrix/m_cumulate](https://openhome.cc/eGossip/OpenSCAD/lib2-m_cumulate.html)
|
||||||
- [m_translation](https://openhome.cc/eGossip/OpenSCAD/lib-m_translation.html)
|
- [matrix/m_translation](https://openhome.cc/eGossip/OpenSCAD/lib2-m_translation.html)
|
||||||
- [m_rotation](https://openhome.cc/eGossip/OpenSCAD/lib-m_rotation.html)
|
- [matrix/m_rotation](https://openhome.cc/eGossip/OpenSCAD/lib2-m_rotation.html)
|
||||||
- [m_scaling](https://openhome.cc/eGossip/OpenSCAD/lib-m_scaling.html)
|
- [matrix/m_scaling](https://openhome.cc/eGossip/OpenSCAD/lib2-m_scaling.html)
|
||||||
- [m_mirror](https://openhome.cc/eGossip/OpenSCAD/lib-m_mirror.html)
|
- [matrix/m_mirror](https://openhome.cc/eGossip/OpenSCAD/lib2-m_mirror.html)
|
||||||
- [m_shearing](https://openhome.cc/eGossip/OpenSCAD/lib-m_shearing.html)
|
- [matrix/m_shearing](https://openhome.cc/eGossip/OpenSCAD/lib2-m_shearing.html)
|
||||||
|
|
||||||
- Other
|
- Turtle
|
||||||
- [turtle2d](https://openhome.cc/eGossip/OpenSCAD/lib-turtle2d.html)
|
- [turtle/turtle2d](https://openhome.cc/eGossip/OpenSCAD/lib2-turtle2d.html)
|
||||||
- [turtle3d](https://openhome.cc/eGossip/OpenSCAD/lib-turtle3d.html)
|
- [turtle/turtle3d](https://openhome.cc/eGossip/OpenSCAD/lib2-turtle3d.html)
|
||||||
- [log](https://openhome.cc/eGossip/OpenSCAD/lib-log.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
|
## Bugs and Feedback
|
||||||
|
|
||||||
For bugs, questions and discussions please use the [Github Issues](https://github.com/JustinSDK/dotSCAD/issues).
|
For bugs, questions and discussions please use the [Github Issues](https://github.com/JustinSDK/dotSCAD/issues).
|
||||||
|
29
RELEASE.md
@@ -1,5 +1,34 @@
|
|||||||
> Version numbers are based on [Semantic Versioning](https://semver.org/).
|
> Version numbers are based on [Semantic Versioning](https://semver.org/).
|
||||||
|
|
||||||
|
# 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
|
# v1.3.1
|
||||||
- Bugfixes
|
- Bugfixes
|
||||||
- `in_polyline`: Wrong parameter name.
|
- `in_polyline`: Wrong parameter name.
|
||||||
|
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
|
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 |
@@ -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.
|
- `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.
|
- `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`.
|
- `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.
|
- `$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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||||
|
@@ -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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `path_pts` : A list of points represent the path.
|
- `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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `t_step` : The distance between two points of the Bézier path.
|
- `t_step` : The distance between two points of the Bézier path.
|
||||||
|
@@ -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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `shape_pts`: A list of points represent a shape. See the example below.
|
- `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
|
## Parameters
|
||||||
|
|
||||||
- `radius` : The radial distance r.
|
- `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)`.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `points` : A set of points `[x, y, f(x, y)]`. See examples below.
|
- `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]`.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `from` : The nth Fibonacci number you wanna start from.
|
- `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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
- `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.
|
Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module.
|
||||||
|
|
||||||
Dependencies: `helix`, `rotate_p`, `cross_sections`, `polysections`.
|
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||||
|
@@ -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);
|
|
||||||
|
|
||||||

|
|
||||||
|
|
@@ -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 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.
|
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
|
## Parameters
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# polyline2d
|
# 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
|
## Parameters
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# polyline3d
|
# 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
|
## 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`.
|
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.
|
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
|
## 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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `radius` : The radius of two circles.
|
- `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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `stroke_pts` : A list of points represent a stroke. See the example below.
|
- `stroke_pts` : A list of points represent a stroke. See the example below.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# sphere_spiral
|
# 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
|
## 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.
|
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
|
## Parameters
|
||||||
|
|
||||||
- `shape_pts` : A list of points represent a shape. See the example below.
|
- `shape_pts` : A list of points represent a shape. See the example below.
|
||||||
|
@@ -6,14 +6,16 @@ The power of using transformation matrice is that you can cumulate all transform
|
|||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
|
The dir changed since 2.0.
|
||||||
|
|
||||||
- `matrice` : A list of 4x4 transformation matrice.
|
- `matrice` : A list of 4x4 transformation matrice.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <m_rotation.scad>;
|
include <matrix/m_rotation.scad>;
|
||||||
include <m_scaling.scad>;
|
include <matrix/m_scaling.scad>;
|
||||||
include <m_translation.scad>;
|
include <matrix/m_translation.scad>;
|
||||||
include <m_cumulate.scad>
|
include <matrix/m_cumulate.scad>
|
||||||
|
|
||||||
m = m_cumulate([
|
m = m_cumulate([
|
||||||
m_translation([10, 20, 10]), m_scaling(2), m_rotation(60)]
|
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
|
# 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.
|
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
|
**Since:** 1.1
|
||||||
@@ -11,7 +13,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to rotate
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <m_rotation.scad>;
|
include <matrix/m_rotation.scad>;
|
||||||
|
|
||||||
point = [20, 0, 0];
|
point = [20, 0, 0];
|
||||||
a = [0, -45, 45];
|
a = [0, -45, 45];
|
@@ -1,5 +1,7 @@
|
|||||||
# m_scaling
|
# 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.
|
Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale its child elements using the specified vector.
|
||||||
|
|
||||||
**Since:** 1.1
|
**Since:** 1.1
|
||||||
@@ -10,7 +12,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to scale i
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <m_scaling.scad>;
|
include <matrix/m_scaling.scad>;
|
||||||
|
|
||||||
cube(10);
|
cube(10);
|
||||||
translate([15, 0, 0])
|
translate([15, 0, 0])
|
@@ -1,5 +1,7 @@
|
|||||||
# m_shearing
|
# 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.
|
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
|
**Since:** 1.1
|
||||||
@@ -12,7 +14,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to shear a
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <m_shearing.scad>;
|
include <matrix/m_shearing.scad>;
|
||||||
|
|
||||||
color("red") {
|
color("red") {
|
||||||
multmatrix(m_shearing(sx = [1, 0]))
|
multmatrix(m_shearing(sx = [1, 0]))
|
@@ -1,5 +1,7 @@
|
|||||||
# m_translation
|
# 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.
|
Generate a 4x4 transformation matrix which can pass into `multmatrix` to translates (moves) its child elements along the specified vector.
|
||||||
|
|
||||||
**Since:** 1.1
|
**Since:** 1.1
|
||||||
@@ -10,11 +12,11 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to transla
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <m_translation.scad>;
|
include <matrix/m_translation.scad>;
|
||||||
|
|
||||||
cube(2, center = true);
|
cube(2, center = true);
|
||||||
multmatrix(m_translation([5, 0, 0]))
|
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 <hull_polyline3d.scad>;
|
||||||
include <shape_taiwan.scad>;
|
include <shape_taiwan.scad>;
|
||||||
include <path_scaling_sections.scad>;
|
include <path_scaling_sections.scad>;
|
||||||
include <m_scaling.scad>;
|
|
||||||
include <polysections.scad>;
|
include <polysections.scad>;
|
||||||
|
|
||||||
taiwan = shape_taiwan(100);
|
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 <hull_polyline3d.scad>;
|
||||||
include <shape_taiwan.scad>;
|
include <shape_taiwan.scad>;
|
||||||
include <path_scaling_sections.scad>;
|
include <path_scaling_sections.scad>;
|
||||||
include <m_scaling.scad>;
|
|
||||||
include <polysections.scad>;
|
include <polysections.scad>;
|
||||||
include <bezier_curve.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 <shape_taiwan.scad>;
|
||||||
include <path_scaling_sections.scad>;
|
include <path_scaling_sections.scad>;
|
||||||
include <m_scaling.scad>;
|
|
||||||
include <polysections.scad>;
|
include <polysections.scad>;
|
||||||
include <bezier_curve.scad>;
|
include <bezier_curve.scad>;
|
||||||
include <rotate_p.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 <hull_polyline3d.scad>;
|
||||||
include <shape_taiwan.scad>;
|
include <shape_taiwan.scad>;
|
||||||
include <path_scaling_sections.scad>;
|
include <path_scaling_sections.scad>;
|
||||||
include <m_scaling.scad>;
|
|
||||||
include <polysections.scad>;
|
include <polysections.scad>;
|
||||||
include <rotate_p.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
|
# 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
|
## Parameters
|
||||||
|
|
||||||
@@ -9,8 +11,8 @@ Splits the given string around matches of the given delimiting character. It dep
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <sub_str.scad>;
|
include <util/sub_str.scad>;
|
||||||
include <split_str.scad>;
|
include <util/split_str.scad>;
|
||||||
|
|
||||||
echo(split_str("hello,world", ",")); // ECHO: ["hello", "world"]
|
echo(split_str("hello,world", ",")); // ECHO: ["hello", "world"]
|
||||||
|
|
@@ -1,6 +1,8 @@
|
|||||||
# sub_str
|
# 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
|
## Parameters
|
||||||
|
|
||||||
@@ -10,7 +12,7 @@ Returns a new string that is a substring of the given string.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <sub_str.scad>;
|
include <util/sub_str.scad>;
|
||||||
|
|
||||||
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
||||||
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
@@ -1,5 +1,7 @@
|
|||||||
# turtle2d
|
# 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.
|
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
|
## Parameters
|
||||||
@@ -16,7 +18,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <line2d.scad>;
|
include <line2d.scad>;
|
||||||
include <turtle2d.scad>;
|
include <turtle/turtle2d.scad>;
|
||||||
|
|
||||||
module turtle_spiral(t_before, times, side_leng, angle, width) {
|
module turtle_spiral(t_before, times, side_leng, angle, width) {
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
@@ -47,7 +49,7 @@ An OpenSCAD implementation of Turtle Graphics. It moves on the xy plane. You can
|
|||||||

|

|
||||||
|
|
||||||
include <line2d.scad>;
|
include <line2d.scad>;
|
||||||
include <turtle2d.scad>;
|
include <turtle/turtle2d.scad>;
|
||||||
|
|
||||||
module turtle_spiral(t_before, side_leng, d_step, min_leng, angle, width) {
|
module turtle_spiral(t_before, side_leng, d_step, min_leng, angle, width) {
|
||||||
$fn = 24;
|
$fn = 24;
|
@@ -1,11 +1,11 @@
|
|||||||
# turtle3d
|
# 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.
|
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).
|
For more details, please see [3D turtle graphics](https://openhome.cc/eGossip/OpenSCAD/3DTurtleGraphics.html).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `cmd` : A string command. Different commands use different numbers of arguments.
|
- `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
|
## Examples
|
||||||
|
|
||||||
include <turtle3d.scad>;
|
include <turtle/turtle3d.scad>;
|
||||||
include <hull_polyline3d.scad>;
|
include <hull_polyline3d.scad>;
|
||||||
|
|
||||||
leng = 10;
|
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>;
|
include <hull_polyline3d.scad>;
|
||||||
|
|
||||||
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
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);
|
38
examples/tree.scad
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
include <turtle/turtle3d.scad>;
|
||||||
|
include <line3d.scad>;
|
||||||
|
|
||||||
|
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
||||||
|
angleZ, angleX, width) {
|
||||||
|
if(leng > leng_limit) {
|
||||||
|
t2 = turtle3d("xu_move", t, leng);
|
||||||
|
|
||||||
|
line3d(
|
||||||
|
turtle3d("pt", t), turtle3d("pt", t2),
|
||||||
|
width);
|
||||||
|
|
||||||
|
tree(
|
||||||
|
turtle3d("zu_turn", t2, angleZ),
|
||||||
|
leng * leng_scale1, leng_scale1, leng_scale2, leng_limit,
|
||||||
|
angleZ, angleX,
|
||||||
|
width);
|
||||||
|
|
||||||
|
tree(
|
||||||
|
turtle3d("xu_turn", t2, angleX),
|
||||||
|
leng * leng_scale2, leng_scale1, leng_scale2, leng_limit,
|
||||||
|
angleZ, angleX,
|
||||||
|
width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leng = 100;
|
||||||
|
leng_limit = 1;
|
||||||
|
leng_scale1 = 0.4;
|
||||||
|
leng_scale2 = 0.9;
|
||||||
|
angleZ = 60;
|
||||||
|
angleX = 135;
|
||||||
|
width = 2;
|
||||||
|
|
||||||
|
t = turtle3d("create");
|
||||||
|
|
||||||
|
tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
||||||
|
angleZ, angleX, width);
|
40
examples/voronoi_bracelet.scad
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
include <hollow_out.scad>;
|
||||||
|
include <voronoi2d.scad>;
|
||||||
|
include <bend_extrude.scad>;
|
||||||
|
|
||||||
|
r = 35;
|
||||||
|
height = 35;
|
||||||
|
thickness = 2.5;
|
||||||
|
n = 25;
|
||||||
|
frags = 24;
|
||||||
|
offset_r = 0.5;
|
||||||
|
region_type = "square"; // [square, circle]
|
||||||
|
|
||||||
|
module voronoi_bracelet(r, height, thickness, n, frags, offset_r, region_type) {
|
||||||
|
$fn = 12;
|
||||||
|
|
||||||
|
x = 2 * PI * r - thickness;
|
||||||
|
y = height;
|
||||||
|
|
||||||
|
xs = rands(0, x, n);
|
||||||
|
ys = rands(0, y, n);
|
||||||
|
|
||||||
|
points = [for(i = [0: len(xs) - 1]) [xs[i], ys[i]]];
|
||||||
|
|
||||||
|
bend_extrude(
|
||||||
|
size = [x, y],
|
||||||
|
thickness = thickness,
|
||||||
|
angle = 360 * (1 - thickness / (2 * PI * r)),
|
||||||
|
frags = frags
|
||||||
|
)
|
||||||
|
{
|
||||||
|
difference() {
|
||||||
|
square([x, y]);
|
||||||
|
voronoi2d(points, spacing = thickness, r = offset_r, region_type = region_type);
|
||||||
|
}
|
||||||
|
hollow_out(thickness * 1.5)
|
||||||
|
square([x, y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
voronoi_bracelet(r, height, thickness, n, frags, offset_r, region_type);
|
69
examples/voronoi_vase.scad
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
include <voronoi3d.scad>;
|
||||||
|
include <bezier_curve.scad>;
|
||||||
|
include <hollow_out.scad>;
|
||||||
|
include <polysections.scad>;
|
||||||
|
|
||||||
|
r = 13;
|
||||||
|
h = 60;
|
||||||
|
thickness = 2;
|
||||||
|
num_of_pts = 16;
|
||||||
|
fn = 6;
|
||||||
|
profile_step = 0.1;
|
||||||
|
|
||||||
|
module voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step) {
|
||||||
|
|
||||||
|
profile = bezier_curve(profile_step, [
|
||||||
|
[r, 0, 0],
|
||||||
|
[r, 0, h / 6],
|
||||||
|
[r + 10, 0, h / 4],
|
||||||
|
[r + 18, 0, h * 0.4],
|
||||||
|
[r + 10, 0, h / 2],
|
||||||
|
[r, 0, h * 2 / 3],
|
||||||
|
[r + 2, 0, h]
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
a_step = 360 / fn;
|
||||||
|
sections = [
|
||||||
|
for(pt = profile) [
|
||||||
|
for(i = [0:fn - 1])
|
||||||
|
let(r = pt[0], z = pt[2], a = a_step * i)
|
||||||
|
[r * cos(a), r * sin(a), z]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
pts = [for(sect = sections) each sect];
|
||||||
|
indices = rands(0, len(pts) - 1, num_of_pts - 4);
|
||||||
|
|
||||||
|
last_section_i = len(sections) - 1;
|
||||||
|
half_fn = fn * 0.5;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sxy = (r * 0.95 - thickness * 0.5) / r;
|
||||||
|
|
||||||
|
difference() {
|
||||||
|
scale([0.95, 0.95, 1])
|
||||||
|
polysections(sections);
|
||||||
|
scale([0.85, 0.85, 1])
|
||||||
|
polysections(sections);
|
||||||
|
intersection() {
|
||||||
|
polysections(sections);
|
||||||
|
render()
|
||||||
|
voronoi3d(concat([for(i = indices) pts[i]], [sections[0][0], sections[0][half_fn], sections[last_section_i][0], sections[last_section_i][half_fn]]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
linear_extrude(thickness)
|
||||||
|
polygon([for(pt = sections[0]) [pt[0], pt[1]]]);
|
||||||
|
|
||||||
|
translate([0, 0, h])
|
||||||
|
linear_extrude(thickness)
|
||||||
|
hollow_out(thickness)
|
||||||
|
polygon([for(pt = sections[last_section_i]) [pt[0], pt[1]]]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step);
|
||||||
|
|
@@ -3,6 +3,6 @@ function __angy_angz(p1, p2) =
|
|||||||
dx = p2[0] - p1[0],
|
dx = p2[0] - p1[0],
|
||||||
dy = p2[1] - p1[1],
|
dy = p2[1] - p1[1],
|
||||||
dz = p2[2] - p1[2],
|
dz = p2[2] - p1[2],
|
||||||
ya = atan2(dz, sqrt(pow(dx, 2) + pow(dy, 2))),
|
ya = atan2(dz, sqrt(dx * dx + dy * dy)),
|
||||||
za = atan2(dy, dx)
|
za = atan2(dy, dx)
|
||||||
) [ya, za];
|
) [ya, za];
|
@@ -1,3 +1,3 @@
|
|||||||
function __frags(radius) = $fn > 0 ?
|
function __frags(radius) = $fn > 0 ?
|
||||||
($fn >= 3 ? $fn : 3) :
|
($fn >= 3 ? $fn : 3) :
|
||||||
max(min(360 / $fa, radius * 6.28318 / $fs), 5);
|
max(min(360 / $fa, radius * PI * 2 / $fs), 5);
|
@@ -44,7 +44,7 @@ function __br_corner(frags, b_ang, l1, l2, h, round_r) =
|
|||||||
|
|
||||||
function __half_trapezium(length, h, round_r) =
|
function __half_trapezium(length, h, round_r) =
|
||||||
let(
|
let(
|
||||||
is_flt = __is_float(length),
|
is_flt = is_num(length),
|
||||||
l1 = is_flt ? length : length[0],
|
l1 = is_flt ? length : length[0],
|
||||||
l2 = is_flt ? length : length[1],
|
l2 = is_flt ? length : length[1],
|
||||||
frags = __frags(round_r),
|
frags = __frags(round_r),
|
10
src/__comm__/__lines_from.scad
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
function __lines_from(pts, closed = false) =
|
||||||
|
let(
|
||||||
|
leng = len(pts),
|
||||||
|
endi = leng - 1
|
||||||
|
)
|
||||||
|
concat(
|
||||||
|
[for(i = 0; i < endi; i = i + 1) [pts[i], pts[i + 1]]],
|
||||||
|
closed ? [[pts[len(pts) - 1], pts[0]]] : []
|
||||||
|
);
|
||||||
|
|
@@ -5,7 +5,7 @@ function __pie_for_rounding(r, begin_a, end_a, frags) =
|
|||||||
is_integer = frags % 1 == 0
|
is_integer = frags % 1 == 0
|
||||||
)
|
)
|
||||||
r < 0.00005 ? [[0, 0]] : concat([
|
r < 0.00005 ? [[0, 0]] : concat([
|
||||||
for(ang = [begin_a:step_a:end_a])
|
for(ang = begin_a; ang <= end_a; ang = ang + step_a)
|
||||||
[
|
[
|
||||||
r * cos(ang),
|
r * cos(ang),
|
||||||
r * sin(ang)
|
r * sin(ang)
|
@@ -3,12 +3,12 @@ function __polytransversals(transversals) =
|
|||||||
leng_trs = len(transversals),
|
leng_trs = len(transversals),
|
||||||
leng_tr = len(transversals[0]),
|
leng_tr = len(transversals[0]),
|
||||||
lefts = [
|
lefts = [
|
||||||
for(i = [1:leng_trs - 2])
|
for(i = 1; i < leng_trs - 1; i = i + 1)
|
||||||
let(tr = transversals[leng_trs - i])
|
let(tr = transversals[leng_trs - i])
|
||||||
tr[0]
|
tr[0]
|
||||||
],
|
],
|
||||||
rights = [
|
rights = [
|
||||||
for(i = [1:leng_trs - 2])
|
for(i = 1; i < leng_trs - 1; i = i + 1)
|
||||||
let(tr = transversals[i])
|
let(tr = transversals[i])
|
||||||
tr[leng_tr - 1]
|
tr[leng_tr - 1]
|
||||||
]
|
]
|
@@ -6,7 +6,7 @@ function __shape_arc(radius, angle, width, width_mode = "LINE_CROSS") =
|
|||||||
frags = __frags(radius),
|
frags = __frags(radius),
|
||||||
a_step = 360 / frags,
|
a_step = 360 / frags,
|
||||||
half_a_step = a_step / 2,
|
half_a_step = a_step / 2,
|
||||||
angles = __is_float(angle) ? [0, angle] : angle,
|
angles = is_num(angle) ? [0, angle] : angle,
|
||||||
m = floor(angles[0] / a_step) + 1,
|
m = floor(angles[0] / a_step) + 1,
|
||||||
n = floor(angles[1] / a_step),
|
n = floor(angles[1] / a_step),
|
||||||
r_outer = radius + w_offset[0],
|
r_outer = radius + w_offset[0],
|
||||||
@@ -15,14 +15,13 @@ function __shape_arc(radius, angle, width, width_mode = "LINE_CROSS") =
|
|||||||
// outer arc path
|
// outer arc path
|
||||||
[__ra_to_xy(__edge_r_begin(r_outer, angles[0], a_step, m), angles[0])],
|
[__ra_to_xy(__edge_r_begin(r_outer, angles[0], a_step, m), angles[0])],
|
||||||
m > n ? [] : [
|
m > n ? [] : [
|
||||||
for(i = [m:n])
|
for(i = m; i <= n; i = i + 1) __ra_to_xy(r_outer, a_step * i)
|
||||||
__ra_to_xy(r_outer, a_step * i)
|
|
||||||
],
|
],
|
||||||
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(r_outer, angles[1], a_step, n), angles[1])],
|
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(r_outer, angles[1], a_step, n), angles[1])],
|
||||||
// inner arc path
|
// inner arc path
|
||||||
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(r_inner, angles[1], a_step, n), angles[1])],
|
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(r_inner, angles[1], a_step, n), angles[1])],
|
||||||
m > n ? [] : [
|
m > n ? [] : [
|
||||||
for(i = [m:n])
|
for(i = m; i <= n; i = i + 1)
|
||||||
let(idx = (n + (m - i)))
|
let(idx = (n + (m - i)))
|
||||||
__ra_to_xy(r_inner, a_step * idx)
|
__ra_to_xy(r_inner, a_step * idx)
|
||||||
|
|
@@ -3,7 +3,7 @@ function __shape_pie(radius, angle) =
|
|||||||
frags = __frags(radius),
|
frags = __frags(radius),
|
||||||
a_step = 360 / frags,
|
a_step = 360 / frags,
|
||||||
leng = radius * cos(a_step / 2),
|
leng = radius * cos(a_step / 2),
|
||||||
angles = __is_float(angle) ? [0:angle] : angle,
|
angles = is_num(angle) ? [0:angle] : angle,
|
||||||
m = floor(angles[0] / a_step) + 1,
|
m = floor(angles[0] / a_step) + 1,
|
||||||
n = floor(angles[1] / a_step),
|
n = floor(angles[1] / a_step),
|
||||||
edge_r_begin = leng / cos((m - 0.5) * a_step - angles[0]),
|
edge_r_begin = leng / cos((m - 0.5) * a_step - angles[0]),
|
||||||
@@ -11,7 +11,7 @@ function __shape_pie(radius, angle) =
|
|||||||
shape_pts = concat(
|
shape_pts = concat(
|
||||||
[[0, 0], __ra_to_xy(edge_r_begin, angles[0])],
|
[[0, 0], __ra_to_xy(edge_r_begin, angles[0])],
|
||||||
m > n ? [] : [
|
m > n ? [] : [
|
||||||
for(i = [m:n])
|
for(i = m; i <= n; i = i + 1)
|
||||||
let(a = a_step * i)
|
let(a = a_step * i)
|
||||||
__ra_to_xy(radius, a)
|
__ra_to_xy(radius, a)
|
||||||
],
|
],
|
@@ -4,4 +4,4 @@ function __to_3_elems_ang_vect(a) =
|
|||||||
leng == 2 ? [a[0], a[1], 0] : [a[0], 0, 0]
|
leng == 2 ? [a[0], a[1], 0] : [a[0], 0, 0]
|
||||||
);
|
);
|
||||||
|
|
||||||
function __to_ang_vect(a) = __is_float(a) ? [0, 0, a] : __to_3_elems_ang_vect(a);
|
function __to_ang_vect(a) = is_num(a) ? [0, 0, a] : __to_3_elems_ang_vect(a);
|
1
src/__comm__/__to_degree.scad
Normal file
@@ -0,0 +1 @@
|
|||||||
|
function __to_degree(phi) = 180 / PI * phi;
|
@@ -3,7 +3,7 @@ function __trapezium(length, h, round_r) =
|
|||||||
r_half_trapezium = __half_trapezium(length / 2, h, round_r),
|
r_half_trapezium = __half_trapezium(length / 2, h, round_r),
|
||||||
to = len(r_half_trapezium) - 1,
|
to = len(r_half_trapezium) - 1,
|
||||||
l_half_trapezium = [
|
l_half_trapezium = [
|
||||||
for(i = [0:to])
|
for(i = 0; i <= to; i = i + 1)
|
||||||
let(pt = r_half_trapezium[to - i])
|
let(pt = r_half_trapezium[to - i])
|
||||||
[-pt[0], pt[1]]
|
[-pt[0], pt[1]]
|
||||||
]
|
]
|
@@ -1 +0,0 @@
|
|||||||
function __is_float(value) = value + 0 != undef;
|
|
@@ -1 +0,0 @@
|
|||||||
function __is_vector(value) = !(value >= "") && len(value) != undef;
|
|
@@ -1,7 +0,0 @@
|
|||||||
function __lines_from(pts, closed = false) =
|
|
||||||
let(leng = len(pts))
|
|
||||||
concat(
|
|
||||||
[for(i = [0:leng - 2]) [pts[i], pts[i + 1]]],
|
|
||||||
closed ? [[pts[len(pts) - 1], pts[0]]] : []
|
|
||||||
);
|
|
||||||
|
|
@@ -1,6 +0,0 @@
|
|||||||
function __reverse(vt) =
|
|
||||||
let(leng = len(vt))
|
|
||||||
[
|
|
||||||
for(i = [0:leng - 1])
|
|
||||||
vt[leng - 1 - i]
|
|
||||||
];
|
|
@@ -1 +0,0 @@
|
|||||||
function __to_degree(phi) = 180 / 3.14159 * phi;
|
|
87
src/all/dotSCAD.scad
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
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>;
|
||||||
|
include <midpt_smooth.scad>;
|
||||||
|
include <multi_line_text.scad>;
|
||||||
|
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>;
|
||||||
|
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>;
|
@@ -8,35 +8,25 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__angy_angz.scad>;
|
include <__comm__/__angy_angz.scad>;
|
||||||
include <__private__/__is_float.scad>;
|
include <__comm__/__to3d.scad>;
|
||||||
include <__private__/__to3d.scad>;
|
include <matrix/__comm__/__m_rotation.scad>;
|
||||||
|
|
||||||
// Becuase of improving the performance, this module requires m_rotation.scad which doesn't require in dotSCAD 1.0.
|
|
||||||
// For backward compatibility, I directly include m_rotation here.
|
|
||||||
include <m_rotation.scad>;
|
|
||||||
|
|
||||||
module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") {
|
module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") {
|
||||||
leng_points = len(points);
|
leng_points = len(points);
|
||||||
leng_points_minus_one = leng_points - 1;
|
leng_points_minus_one = leng_points - 1;
|
||||||
twist_step_a = twist / leng_points;
|
twist_step_a = twist / leng_points;
|
||||||
|
|
||||||
angles_defined = angles != undef;
|
angles_defined = !is_undef(angles);
|
||||||
|
|
||||||
scale_step_vt = __is_float(scale) ?
|
scale_step_vt = is_num(scale) ?
|
||||||
scale_step() :
|
let(s = (scale - 1) / leng_points_minus_one) [s, s, s] :
|
||||||
[
|
[
|
||||||
(scale[0] - 1) / leng_points_minus_one,
|
(scale[0] - 1) / leng_points_minus_one,
|
||||||
(scale[1] - 1) / leng_points_minus_one,
|
(scale[1] - 1) / leng_points_minus_one,
|
||||||
scale[2] == undef ? 0 : (scale[2] - 1) / leng_points_minus_one
|
is_undef(scale[2]) ? 0 : (scale[2] - 1) / leng_points_minus_one
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
function scale_step() =
|
|
||||||
let(s = (scale - 1) / leng_points_minus_one)
|
|
||||||
[s, s, s];
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Sadly, children(n) cannot be used with inner modules
|
Sadly, children(n) cannot be used with inner modules
|
||||||
so I have to do things in the first level. Ugly!!
|
so I have to do things in the first level. Ugly!!
|
||||||
@@ -53,16 +43,16 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
|||||||
];
|
];
|
||||||
|
|
||||||
function axis_angle_local_ang_vects(j) =
|
function axis_angle_local_ang_vects(j) =
|
||||||
j == 0 ? [] : axis_angle_local_ang_vects_sub(j);
|
[
|
||||||
|
for(i = j; i > 0; i = i - 1)
|
||||||
function axis_angle_local_ang_vects_sub(j) =
|
let(
|
||||||
let(
|
vt0 = points[i] - points[i - 1],
|
||||||
vt0 = points[j] - points[j - 1],
|
vt1 = points[i + 1] - points[i],
|
||||||
vt1 = points[j + 1] - points[j],
|
a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))),
|
||||||
a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))),
|
v = cross(vt0, vt1)
|
||||||
v = cross(vt0, vt1)
|
)
|
||||||
)
|
[a, v]
|
||||||
concat([[a, v]], axis_angle_local_ang_vects(j - 1));
|
];
|
||||||
|
|
||||||
function axis_angle_cumulated_rot_matrice(i, rot_matrice) =
|
function axis_angle_cumulated_rot_matrice(i, rot_matrice) =
|
||||||
let(
|
let(
|
||||||
@@ -101,7 +91,6 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
|||||||
|
|
||||||
module axis_angle_align_with_pts_init(a, s) {
|
module axis_angle_align_with_pts_init(a, s) {
|
||||||
angleyz = __angy_angz(__to3d(points[0]), __to3d(points[1]));
|
angleyz = __angy_angz(__to3d(points[0]), __to3d(points[1]));
|
||||||
|
|
||||||
rotate([0, -angleyz[0], angleyz[1]])
|
rotate([0, -angleyz[0], angleyz[1]])
|
||||||
rotate([90, 0, -90])
|
rotate([90, 0, -90])
|
||||||
rotate(a)
|
rotate(a)
|
||||||
@@ -126,13 +115,8 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
|||||||
|
|
||||||
// >>> begin: modules and functions for "EULER-ANGLE"
|
// >>> begin: modules and functions for "EULER-ANGLE"
|
||||||
|
|
||||||
function _euler_angle_path_angles(pts, end_i, i = 0) =
|
function _euler_angle_path_angles(pts, end_i) =
|
||||||
i == end_i ?
|
[for(i = 0; i < end_i; i = i + 1) __angy_angz(pts[i], pts[i + 1])];
|
||||||
[] :
|
|
||||||
concat(
|
|
||||||
[__angy_angz(pts[i], pts[i + 1])],
|
|
||||||
_euler_angle_path_angles(pts, end_i, i + 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
function euler_angle_path_angles(children) =
|
function euler_angle_path_angles(children) =
|
||||||
let(
|
let(
|
||||||
@@ -171,7 +155,7 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
|||||||
else {
|
else {
|
||||||
cumu_rot_matrice = axis_angle_cumulated_rot_matrice(0, [
|
cumu_rot_matrice = axis_angle_cumulated_rot_matrice(0, [
|
||||||
for(ang_vect = axis_angle_local_ang_vects(leng_points - 2))
|
for(ang_vect = axis_angle_local_ang_vects(leng_points - 2))
|
||||||
m_rotation(ang_vect[0], ang_vect[1])
|
__m_rotation(ang_vect[0], ang_vect[1])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
translate(points[0])
|
translate(points[0])
|
||||||
@@ -194,19 +178,22 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(method == "EULER_ANGLE") {
|
else if(method == "EULER_ANGLE") {
|
||||||
|
angs = angles_defined ? angles : euler_angle_path_angles($children);
|
||||||
|
|
||||||
if($children == 1) {
|
if($children == 1) {
|
||||||
angs = angles_defined ? angles : euler_angle_path_angles($children);
|
|
||||||
|
|
||||||
for(i = [0:leng_points_minus_one]) {
|
for(i = [0:leng_points_minus_one]) {
|
||||||
euler_angle_align(i, angs) children(0);
|
euler_angle_align(i, angs) children(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for(i = [0:min(leng_points, $children) - 1]) {
|
for(i = [0:min(leng_points, $children) - 1]) {
|
||||||
euler_angle_align(i, angs) children(i);
|
euler_angle_align(i, angs) children(i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
test_along_with_angles(angs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_along_with_angles(angles) {
|
||||||
|
|
||||||
}
|
}
|
@@ -8,11 +8,10 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__frags.scad>;
|
include <__comm__/__frags.scad>;
|
||||||
include <__private__/__is_float.scad>;
|
include <__comm__/__ra_to_xy.scad>;
|
||||||
include <__private__/__ra_to_xy.scad>;
|
include <__comm__/__edge_r.scad>;
|
||||||
include <__private__/__edge_r.scad>;
|
include <__comm__/__shape_arc.scad>;
|
||||||
include <__private__/__shape_arc.scad>;
|
|
||||||
|
|
||||||
module arc(radius, angle, width, width_mode = "LINE_CROSS") {
|
module arc(radius, angle, width, width_mode = "LINE_CROSS") {
|
||||||
polygon(__shape_arc(radius, angle, width, width_mode));
|
polygon(__shape_arc(radius, angle, width, width_mode));
|
||||||
|
@@ -8,21 +8,20 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__frags.scad>;
|
include <__comm__/__frags.scad>;
|
||||||
include <__private__/__is_float.scad>;
|
include <__comm__/__ra_to_xy.scad>;
|
||||||
include <__private__/__ra_to_xy.scad>;
|
include <__comm__/__edge_r.scad>;
|
||||||
include <__private__/__edge_r.scad>;
|
|
||||||
|
|
||||||
function arc_path(radius, angle) =
|
function arc_path(radius, angle) =
|
||||||
let(
|
let(
|
||||||
frags = __frags(radius),
|
frags = __frags(radius),
|
||||||
a_step = 360 / frags,
|
a_step = 360 / frags,
|
||||||
angles = __is_float(angle) ? [0, angle] : angle,
|
angles = is_num(angle) ? [0, angle] : angle,
|
||||||
m = floor(angles[0] / a_step) + 1,
|
m = floor(angles[0] / a_step) + 1,
|
||||||
n = floor(angles[1] / a_step),
|
n = floor(angles[1] / a_step),
|
||||||
points = concat([__ra_to_xy(__edge_r_begin(radius, angles[0], a_step, m), angles[0])],
|
points = concat([__ra_to_xy(__edge_r_begin(radius, angles[0], a_step, m), angles[0])],
|
||||||
m > n ? [] : [
|
m > n ? [] : [
|
||||||
for(i = [m:n])
|
for(i = m; i <= n; i = i + 1)
|
||||||
__ra_to_xy(radius, a_step * i)
|
__ra_to_xy(radius, a_step * i)
|
||||||
],
|
],
|
||||||
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(radius, angles[1], a_step, n), angles[1])])
|
angles[1] == a_step * n ? [] : [__ra_to_xy(__edge_r_end(radius, angles[1], a_step, n), angles[1])])
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
function _radian_step(b, theta, l) =
|
function _radian_step(b, theta, l) =
|
||||||
let(r_square = pow(b * theta, 2))
|
let(r_square = pow(b * theta, 2))
|
||||||
acos((2 * r_square - pow(l, 2)) / (2 * r_square)) / 180 * 3.14159;
|
acos((2 * r_square - pow(l, 2)) / (2 * r_square)) / 180 * PI;
|
||||||
|
|
||||||
function _find_radians(b, point_distance, radians, n, count = 1) =
|
function _find_radians(b, point_distance, radians, n, count = 1) =
|
||||||
let(pre_radians = radians[count - 1])
|
let(pre_radians = radians[count - 1])
|
||||||
@@ -27,7 +27,7 @@ function _find_radians(b, point_distance, radians, n, count = 1) =
|
|||||||
);
|
);
|
||||||
|
|
||||||
function archimedean_spiral(arm_distance, init_angle, point_distance, num_of_points, rt_dir = "CT_CLK") =
|
function archimedean_spiral(arm_distance, init_angle, point_distance, num_of_points, rt_dir = "CT_CLK") =
|
||||||
let(b = arm_distance / 6.28318, init_radian = init_angle *3.14159 / 180)
|
let(b = arm_distance / (2 * PI), init_radian = init_angle * PI / 180)
|
||||||
[
|
[
|
||||||
for(theta = _find_radians(b, point_distance, [init_radian], num_of_points))
|
for(theta = _find_radians(b, point_distance, [init_radian], num_of_points))
|
||||||
let(r = b * theta, a = (rt_dir == "CT_CLK" ? 1 : -1) * theta * 57.2958)
|
let(r = b * theta, a = (rt_dir == "CT_CLK" ? 1 : -1) * theta * 57.2958)
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__to2d.scad>;
|
include <__comm__/__to2d.scad>;
|
||||||
|
|
||||||
function _combi(n, k) =
|
function _combi(n, k) =
|
||||||
let(
|
let(
|
||||||
@@ -51,7 +51,7 @@ function _bezier_curve_point(t, points) =
|
|||||||
function bezier_curve(t_step, points) =
|
function bezier_curve(t_step, points) =
|
||||||
let(
|
let(
|
||||||
pts = concat([
|
pts = concat([
|
||||||
for(t = [0: ceil(1 / t_step) - 1])
|
for(t = 0; t < ceil(1 / t_step); t = t + 1)
|
||||||
_bezier_curve_point(t * t_step, points)
|
_bezier_curve_point(t * t_step, points)
|
||||||
], [_bezier_curve_point(1, points)])
|
], [_bezier_curve_point(1, points)])
|
||||||
)
|
)
|
||||||
|
@@ -8,9 +8,9 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
include <__private__/__to3d.scad>;
|
include <__comm__/__to3d.scad>;
|
||||||
include <__private__/__to2d.scad>;
|
include <__comm__/__to2d.scad>;
|
||||||
include <__private__/__angy_angz.scad>;
|
include <__comm__/__angy_angz.scad>;
|
||||||
|
|
||||||
function _corner_ctrl_pts(round_d, p1, p2, p3) =
|
function _corner_ctrl_pts(round_d, p1, p2, p3) =
|
||||||
let(
|
let(
|
||||||
@@ -37,13 +37,13 @@ function _corner_ctrl_pts(round_d, p1, p2, p3) =
|
|||||||
function _bezier_corner(round_d, t_step, p1, p2, p3) =
|
function _bezier_corner(round_d, t_step, p1, p2, p3) =
|
||||||
bezier_curve(t_step, _corner_ctrl_pts(round_d, p1, p2, p3));
|
bezier_curve(t_step, _corner_ctrl_pts(round_d, p1, p2, p3));
|
||||||
|
|
||||||
function _recursive_bezier_smooth(pts, round_d, t_step, leng, i = 0) =
|
function _recursive_bezier_smooth(pts, round_d, t_step, leng) =
|
||||||
i <= leng - 3 ?
|
let(end_i = leng - 2)
|
||||||
concat(
|
[
|
||||||
_bezier_corner(round_d, t_step, pts[i], pts[i + 1], pts[i + 2]),
|
for(i = 0; i < end_i; i = i + 1)
|
||||||
_recursive_bezier_smooth(pts, round_d, t_step, leng, i + 1)
|
each _bezier_corner(round_d, t_step, pts[i], pts[i + 1], pts[i + 2])
|
||||||
)
|
];
|
||||||
: [];
|
|
||||||
|
|
||||||
function bezier_smooth(path_pts, round_d, t_step = 0.1, closed = false) =
|
function bezier_smooth(path_pts, round_d, t_step = 0.1, closed = false) =
|
||||||
let(
|
let(
|
||||||
|
@@ -10,10 +10,10 @@
|
|||||||
|
|
||||||
function bezier_surface(t_step, ctrl_pts) =
|
function bezier_surface(t_step, ctrl_pts) =
|
||||||
let(pts = [
|
let(pts = [
|
||||||
for(i = [0:len(ctrl_pts) - 1])
|
for(i = 0; i < len(ctrl_pts); i = i + 1)
|
||||||
bezier_curve(t_step, ctrl_pts[i])
|
bezier_curve(t_step, ctrl_pts[i])
|
||||||
])
|
])
|
||||||
[for(x = [0:len(pts[0]) - 1])
|
[for(x = 0; x < len(pts[0]); x = x + 1)
|
||||||
bezier_curve(t_step,
|
bezier_curve(t_step,
|
||||||
[for(y = [0:len(pts) - 1]) pts[y][x]]
|
[for(y = [0:len(pts) - 1]) pts[y][x]]
|
||||||
)
|
)
|
||||||
|