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

275 Commits
v1.3.1 ... v2.0

Author SHA1 Message Date
Justin Lin
86f94d2499 update readme 2019-07-17 08:45:07 +08:00
Justin Lin
6737b4a43e fix conflicts 2019-07-17 08:37:33 +08:00
Justin Lin
3dde9f2745 add dotSCAD 2019-07-15 08:24:54 +08:00
Justin Lin
3ac4136043 fix include 2019-07-15 08:23:38 +08:00
Justin Lin
70879d4c73 update release 2019-07-15 08:18:50 +08:00
Justin Lin
840f8df3ae add voronoi_vase 2019-07-14 11:10:05 +08:00
Justin Lin
49e13d920a add superformula_vase 2019-07-14 10:58:31 +08:00
Justin Lin
948410ec56 rename 2019-07-14 10:15:27 +08:00
Justin Lin
8576d93dd8 update tree 2019-07-14 10:14:10 +08:00
Justin Lin
47a3f9c155 add tree 2019-07-14 10:10:29 +08:00
Justin Lin
93c7ea5c9d add dancing_taiwan 2019-07-13 18:21:04 +08:00
Justin Lin
cfda38c8bd add text_sphere.scad 2019-07-13 16:44:24 +08:00
Justin Lin
d3640830c4 add klein bottle 2019-07-12 16:38:49 +08:00
Justin Lin
dac87e49c5 update README 2019-07-09 07:33:36 +08:00
Justin Lin
843063db31 add knot 2019-07-08 08:10:31 +08:00
Justin Lin
30c1e0fb13 add stereographic_projection 2019-07-06 18:26:21 +08:00
Justin Lin
8727bfbf8b refactor 2019-07-06 07:51:14 +08:00
Justin Lin
c12e160e03 add blackbear 2019-07-05 21:09:48 +08:00
Justin Lin
110bc5c400 update image 2019-07-05 21:01:59 +08:00
Justin Lin
8fdd195949 update featured image 2019-07-05 20:57:35 +08:00
Justin Lin
4c65e12a88 add voronoi_bracelet 2019-07-05 20:06:51 +08:00
Justin Lin
1816aad98e add text_tower 2019-07-05 13:50:34 +08:00
Justin Lin
28e8a5c4b2 update README 2019-07-04 14:54:08 +08:00
Justin Lin
d849034bc7 add comment 2019-07-04 14:53:34 +08:00
Justin Lin
2c1f8faa56 format 2019-07-04 14:53:14 +08:00
Justin Lin
b998cc8f32 add doc 2019-07-04 14:52:57 +08:00
Justin Lin
e126b1af1d add comment 2019-07-04 14:47:09 +08:00
Justin Lin
b256bf7c90 add doc 2019-07-04 14:46:40 +08:00
Justin Lin
3c830cc90d add example 2019-07-02 16:17:48 +08:00
Justin Lin
76b973d824 update README 2019-07-02 15:43:57 +08:00
Justin Lin
90c05523ce add comments 2019-07-02 15:43:23 +08:00
Justin Lin
0cfa510874 add doc 2019-07-02 15:42:35 +08:00
Justin Lin
9b6c17ace4 add doc 2019-07-02 15:35:57 +08:00
Justin Lin
43f84ba478 update doc 2019-07-02 15:29:11 +08:00
Justin Lin
8ee52bd672 update RELEASE 2019-07-02 14:31:20 +08:00
Justin Lin
dc5e063b25 update RELEASE 2019-07-02 14:29:25 +08:00
Justin Lin
aae8f688c0 update functions 2019-07-02 14:28:36 +08:00
Justin Lin
60931ec8b9 refactor 2019-07-01 10:02:12 +08:00
Justin Lin
5a15dd9fdb refactor 2019-07-01 10:01:12 +08:00
Justin Lin
6bb3b445b4 refactor 2019-07-01 07:46:25 +08:00
Justin Lin
66bb8ef643 update comments 2019-07-01 07:44:41 +08:00
Justin Lin
4d02e6bb65 add comments 2019-07-01 07:43:54 +08:00
Justin Lin
681d697840 update doc 2019-06-30 20:30:12 +08:00
Justin Lin
8a8e28c61d update README 2019-06-30 20:28:22 +08:00
Justin Lin
55c2cd6fda add comment 2019-06-30 20:27:21 +08:00
Justin Lin
273d32dc69 add doc 2019-06-30 20:25:53 +08:00
Justin Lin
472d5c7ba7 update doc 2019-06-30 20:22:03 +08:00
Justin Lin
eba7f63576 update README 2019-06-30 18:29:45 +08:00
Justin Lin
ec18d2eeeb add comment 2019-06-30 18:28:58 +08:00
Justin Lin
51e5356f21 add doc 2019-06-30 18:28:01 +08:00
Justin Lin
582050d096 rename 2019-06-30 18:27:57 +08:00
Justin Lin
b7d8d3e87c update doc 2019-06-29 18:18:51 +08:00
Justin Lin
ed6ddec02c update doc 2019-06-29 18:18:11 +08:00
Justin Lin
ab0504607d update test case 2019-06-29 18:16:06 +08:00
Justin Lin
b3ae216b72 change default value 2019-06-29 18:15:12 +08:00
Justin Lin
a6caaac787 rename 2019-06-29 17:53:55 +08:00
Justin Lin
f915b07289 rename 2019-06-29 17:53:38 +08:00
Justin Lin
1ff5d848d2 add width param 2019-06-29 17:52:19 +08:00
Justin Lin
8de9c7f138 update test case 2019-06-29 17:52:06 +08:00
Justin Lin
92c1667194 update test case 2019-06-29 17:47:54 +08:00
Justin Lin
e26e6d7472 add width param 2019-06-29 17:46:14 +08:00
Justin Lin
47b5b91b0a use internal px_circle 2019-06-29 17:14:10 +08:00
Justin Lin
cda26241dd change order 2019-06-29 17:01:36 +08:00
Justin Lin
cfa0d211ed update doc 2019-06-29 10:40:03 +08:00
Justin Lin
0a73460884 update README 2019-06-29 10:31:21 +08:00
Justin Lin
774229e3f9 add doc 2019-06-29 10:29:43 +08:00
Justin Lin
b1c3e371a3 change default value 2019-06-29 10:29:37 +08:00
Justin Lin
e45c16fe3f refactor 2019-06-29 10:15:28 +08:00
Justin Lin
2b36c42c99 update doc 2019-06-29 10:02:47 +08:00
Justin Lin
bec487baba add doc 2019-06-29 10:01:46 +08:00
Justin Lin
ce0daaf6bc update doc 2019-06-29 10:01:43 +08:00
Justin Lin
46c25aa51e add doc 2019-06-29 09:53:02 +08:00
Justin Lin
f542661e2a rename 2019-06-29 09:52:06 +08:00
Justin Lin
172e1f8ceb change order 2019-06-28 07:54:08 +08:00
Justin Lin
31c6ee8599 order by y, order by x 2019-06-28 06:41:18 +08:00
Justin Lin
d9199bf9ed use range 2019-06-28 06:38:15 +08:00
Justin Lin
3b57412108 update README 2019-06-27 08:54:18 +08:00
Justin Lin
fd684a10cb add sort 2019-06-27 08:53:15 +08:00
Justin Lin
aa5fc938d0 change order 2019-06-27 07:32:05 +08:00
Justin Lin
ac1167eacc fix wrong variable 2019-06-26 09:43:40 +08:00
Justin Lin
691a8f3ff9 add modules 2019-06-26 09:42:40 +08:00
Justin Lin
e6280ad9f4 update README 2019-06-25 18:12:27 +08:00
Justin Lin
0c6744c62d fix variable name 2019-06-25 18:09:36 +08:00
Justin Lin
6d858125c2 modify dep 2019-06-25 18:09:15 +08:00
Justin Lin
cad5623248 add px_polygon 2019-06-25 18:08:14 +08:00
Justin Lin
07fd4e47e3 fix variable name 2019-06-25 18:05:26 +08:00
Justin Lin
108a232981 update README 2019-06-24 20:06:16 +08:00
Justin Lin
912adba419 add slice 2019-06-24 20:05:58 +08:00
Justin Lin
53a69477d6 refactor 2019-06-24 18:02:24 +08:00
Justin Lin
5f3bfb391d update doc 2019-06-24 07:29:42 +08:00
Justin Lin
16509eec6c update README 2019-06-23 10:09:55 +08:00
Justin Lin
15a03b7fb2 update doc 2019-06-23 10:07:44 +08:00
Justin Lin
deec59b408 change dir 2019-06-23 10:07:06 +08:00
Justin Lin
8fa2de0a60 update doc 2019-06-23 10:05:02 +08:00
Justin Lin
5d012ece48 change dir 2019-06-23 10:04:18 +08:00
Justin Lin
b1687bece2 update doc 2019-06-23 10:02:08 +08:00
Justin Lin
2d9562c8b6 change dir 2019-06-23 10:00:40 +08:00
Justin Lin
c8e1244651 update README 2019-06-23 09:51:18 +08:00
Justin Lin
862fabcd3a add reverse 2019-06-23 09:50:25 +08:00
Justin Lin
1a28d90853 change dir 2019-06-23 09:49:16 +08:00
Justin Lin
9d1804a4d1 rename __private__ to __comm__ 2019-06-23 09:37:02 +08:00
Justin Lin
502ef06db2 refactor 2019-06-23 09:34:38 +08:00
Justin Lin
810f298c70 refactor 2019-06-23 09:33:03 +08:00
Justin Lin
0408ec9cbe refactor 2019-06-23 09:30:32 +08:00
Justin Lin
be05e3b68e fix end i 2019-06-23 09:10:37 +08:00
Justin Lin
65119984fd fix include 2019-06-23 09:02:53 +08:00
Justin Lin
bdb4dace7f fix include 2019-06-23 08:57:23 +08:00
Justin Lin
4aff538837 change end cond 2019-06-23 08:53:32 +08:00
Justin Lin
c0fb254c43 update README 2019-06-22 14:38:53 +08:00
Justin Lin
dd03a9f3db fix wrong funcall 2019-06-22 14:35:39 +08:00
Justin Lin
eca1d20c70 update README 2019-06-22 14:28:21 +08:00
Justin Lin
d9f065a734 fix wrong funcall 2019-06-22 14:25:31 +08:00
Justin Lin
a5d2c24ea1 refactor 2019-06-22 14:24:22 +08:00
Justin Lin
aa12110504 refactor 2019-06-22 14:23:02 +08:00
Justin Lin
8f0b40322e rename 2019-06-22 14:21:50 +08:00
Justin Lin
d4aaee1db9 update doc 2019-06-22 14:16:04 +08:00
Justin Lin
ee89119f2f add dir 2019-06-22 14:15:18 +08:00
Justin Lin
d1bd586bee not necessary 2019-06-22 14:14:00 +08:00
Justin Lin
f88b7bf8f3 rename 2019-06-22 14:13:35 +08:00
Justin Lin
fbd10cd25d update doc 2019-06-22 14:10:37 +08:00
Justin Lin
dfe76bff78 update doc 2019-06-22 14:06:50 +08:00
Justin Lin
d743f36086 update doc 2019-06-22 13:52:07 +08:00
Justin Lin
f1eda43ac0 add test case 2019-06-22 13:48:47 +08:00
Justin Lin
569171971b use dir to simulate namespace 2019-06-22 13:41:59 +08:00
Justin Lin
cb4b3e6685 update test case 2019-06-22 13:40:34 +08:00
Justin Lin
eaed7ff34f refactor 2019-06-22 13:38:57 +08:00
Justin Lin
2c00ef8525 refactor 2019-06-22 13:38:17 +08:00
Justin Lin
17c62ba293 refactor 2019-06-22 13:37:27 +08:00
Justin Lin
ae78c61491 refactor 2019-06-22 09:19:59 +08:00
Justin Lin
e9b1e7f61f don't cal repeatly 2019-06-22 09:17:45 +08:00
Justin Lin
9ed4e1c42b update README 2019-06-21 20:23:15 +08:00
Justin Lin
72197670cb add test case 2019-06-21 20:22:56 +08:00
Justin Lin
b9d88334c5 add px_sphere 2019-06-21 20:17:31 +08:00
Justin Lin
937b6a35bd update README 2019-06-21 17:47:00 +08:00
Justin Lin
5aec44eba8 modify test case 2019-06-21 07:33:52 +08:00
Justin Lin
2f6a170d2c delete center 2019-06-21 07:33:44 +08:00
Justin Lin
5fff65c0d1 modify test case 2019-06-21 07:29:37 +08:00
Justin Lin
3aa5d552c0 delete center 2019-06-21 07:29:29 +08:00
Justin Lin
631d0c8506 change default value 2019-06-21 06:38:01 +08:00
Justin Lin
5d8abc1028 search from OPENSCADPATH 2019-06-20 20:49:29 +08:00
Justin Lin
59ae810383 OpenSCAD search from OPENSCADPATH 2019-06-20 20:48:58 +08:00
Justin Lin
ccce2706f0 update README 2019-06-20 20:31:59 +08:00
Justin Lin
c680780d11 update README 2019-06-20 20:29:58 +08:00
Justin Lin
0d829b7185 add px_cylinder 2019-06-20 20:23:53 +08:00
Justin Lin
e3706e1f87 add px_cylinder 2019-06-20 20:23:36 +08:00
Justin Lin
9f1aa6a653 add test case 2019-06-20 20:22:49 +08:00
Justin Lin
67a7d20880 add px_cylinder 2019-06-20 20:15:21 +08:00
Justin Lin
7cc01a05c6 modify test case 2019-06-20 20:02:02 +08:00
Justin Lin
f9dd9deb53 set center default [0, 0] 2019-06-20 20:01:51 +08:00
Justin Lin
a747bcff3a update README 2019-06-20 18:33:22 +08:00
Justin Lin
d94381dee2 update README 2019-06-20 14:35:53 +08:00
Justin Lin
8ef20b16e3 add px_circle 2019-06-20 10:11:38 +08:00
Justin Lin
de1d0166e6 update README 2019-06-20 09:27:55 +08:00
Justin Lin
eb8305966d update doc 2019-06-20 09:27:30 +08:00
Justin Lin
2d74627e45 use dir to simulate namespace 2019-06-20 09:27:24 +08:00
Justin Lin
945aeacdc4 update README 2019-06-20 09:21:10 +08:00
Justin Lin
17b731ad8f use dir to simulate namespace 2019-06-20 09:19:42 +08:00
Justin Lin
3830a2e523 update README 2019-06-20 08:37:03 +08:00
Justin Lin
62840eb510 add test_px_circle 2019-06-20 08:36:51 +08:00
Justin Lin
d6021374ba add px_circle 2019-06-20 08:34:29 +08:00
Justin Lin
43e5e66529 update README 2019-06-19 09:07:37 +08:00
Justin Lin
dde0156642 add px_polyline 2019-06-19 09:03:00 +08:00
Justin Lin
edabcb8f79 add test case 2019-06-19 09:02:17 +08:00
Justin Lin
f7398f0d84 add px_polyline 2019-06-19 08:59:05 +08:00
Justin Lin
0f37651bc3 fix end cond 2019-06-19 08:48:23 +08:00
Justin Lin
2df7a64ad7 add px_line 2019-06-18 20:28:47 +08:00
Justin Lin
0b4097fd09 add test case 2019-06-18 20:28:16 +08:00
Justin Lin
0bad260d46 add px_line.scad 2019-06-18 20:27:14 +08:00
Justin Lin
e414d2859b update README 2019-06-17 20:25:03 +08:00
Justin Lin
c9d0122779 update RELEASE 2019-06-17 20:24:29 +08:00
Justin Lin
daed828c9a add dotSCAD.scad 2019-06-17 20:23:33 +08:00
Justin Lin
8ceae06645 update RELEASE 2019-06-17 20:18:45 +08:00
Justin Lin
299b3869fd update README 2019-06-17 20:18:28 +08:00
Justin Lin
80fb650df4 update RELEASE 2019-06-17 20:15:38 +08:00
Justin Lin
919ae2f158 update RLEASE 2019-06-17 20:14:59 +08:00
Justin Lin
a851ee6bb7 add dotSCAD 2019-06-17 20:12:34 +08:00
Justin Lin
340847cd19 add missing doc 2019-06-17 10:02:25 +08:00
Justin Lin
5b21cc10d7 add missing doc 2019-06-17 10:01:45 +08:00
Justin Lin
ab99a24352 update docs 2019-06-17 08:33:00 +08:00
Justin Lin
f4696f231e fix wrong scope 2019-06-17 08:26:21 +08:00
Justin Lin
218db7f7a8 update test case 2019-06-17 08:18:54 +08:00
Justin Lin
bb8604e42b fix wrong angs 2019-06-17 08:18:40 +08:00
Justin Lin
9182575ff2 add test case 2019-06-17 07:36:17 +08:00
Justin Lin
ed9477ece5 refactor 2019-06-16 21:09:41 +08:00
Justin Lin
56d2fb648f refactor 2019-06-16 21:07:23 +08:00
Justin Lin
057ad863af refactor 2019-06-16 18:25:45 +08:00
Justin Lin
002711ae3e add test case 2019-06-16 18:23:10 +08:00
Justin Lin
8a5956e852 sub_str can handle undef 2019-06-16 17:42:17 +08:00
Justin Lin
0eb1387f27 refactor 2019-06-16 17:31:51 +08:00
Justin Lin
46dfe4ff25 update test case 2019-06-16 17:30:17 +08:00
Justin Lin
323e81a82c refactor 2019-06-16 16:47:44 +08:00
Justin Lin
61c6e9f70d refactor 2019-06-16 16:44:01 +08:00
Justin Lin
2af270a8da refactor 2019-06-16 11:05:43 +08:00
Justin Lin
c4c9831798 add test_case 2019-06-16 10:33:55 +08:00
Justin Lin
03ac58acaa refactor 2019-06-15 21:14:16 +08:00
Justin Lin
2110b9cb31 refactor 2019-06-15 20:53:54 +08:00
Justin Lin
93d7c0239d not necessary 2019-06-15 11:20:00 +08:00
Justin Lin
5a37620a5b use for each 2019-06-15 11:19:31 +08:00
Justin Lin
8bc6a0b4c9 refactor 2019-06-15 11:04:16 +08:00
Justin Lin
06831ffe15 c-style for loop 2019-06-15 10:56:33 +08:00
Justin Lin
df5775bd05 avoid warning 2019-06-15 10:49:58 +08:00
Justin Lin
2d755a6cbf update doc 2019-06-15 10:20:40 +08:00
Justin Lin
01fc0298f6 remove dependency 2019-06-15 10:18:43 +08:00
Justin Lin
a07244fd47 update doc 2019-06-15 10:18:19 +08:00
Justin Lin
e3443bf0e8 remove dependency 2019-06-15 10:15:21 +08:00
Justin Lin
643266f4a3 c-style for loop 2019-06-14 21:26:28 +08:00
Justin Lin
5a0a4a8fa4 add test case 2019-06-14 21:24:15 +08:00
Justin Lin
78127faba6 c-style for loop 2019-06-14 21:21:08 +08:00
Justin Lin
d203fe4030 add test case 2019-06-14 21:18:22 +08:00
Justin Lin
3be3a271e6 c-style for loop 2019-06-14 13:44:47 +08:00
Justin Lin
f5d813839b add test case 2019-06-14 13:44:38 +08:00
Justin Lin
0a604c5793 c-style for loop 2019-06-14 13:38:32 +08:00
Justin Lin
f1a8d6f0dc c-style for loop 2019-06-14 13:35:10 +08:00
Justin Lin
af084fb043 c-style for loop 2019-06-14 09:01:43 +08:00
Justin Lin
0510b18516 c-style for and each 2019-06-14 08:50:35 +08:00
Justin Lin
78bfb2f31d add test case 2019-06-14 08:44:02 +08:00
Justin Lin
e185e9b7e9 c-style for loop 2019-06-14 08:38:24 +08:00
Justin Lin
3fb08570c6 add test case 2019-06-14 08:37:51 +08:00
Justin Lin
41db148815 c-style for loop 2019-06-14 08:32:28 +08:00
Justin Lin
beaebfcc37 c-style for loop 2019-06-14 08:31:04 +08:00
Justin Lin
6493eea0ac refactor 2019-06-13 20:46:53 +08:00
Justin Lin
6299da9d23 c-style for loop 2019-06-13 20:37:16 +08:00
Justin Lin
e5850f871d c-style for loop 2019-06-13 20:35:55 +08:00
Justin Lin
85c75018f1 add test case 2019-06-13 20:27:01 +08:00
Justin Lin
e84c7bc7a0 refactor 2019-06-13 20:26:21 +08:00
Justin Lin
f9d609087d add test case 2019-06-13 20:19:09 +08:00
Justin Lin
14bbb3f205 fixed name error 2019-06-13 20:19:01 +08:00
Justin Lin
3376b870a7 c-style for loop 2019-06-13 20:07:20 +08:00
Justin Lin
90d2f1ac9c c-style for loop 2019-06-13 09:11:04 +08:00
Justin Lin
fe8256ef0d c-style for loop 2019-06-13 09:08:44 +08:00
Justin Lin
7351e401c9 c-style for loop 2019-06-13 09:06:55 +08:00
Justin Lin
e26d1d3233 refactor 2019-06-13 08:45:13 +08:00
Justin Lin
957e5ab5d5 missing dependency 2019-06-13 08:31:54 +08:00
Justin Lin
0218724b48 refactor 2019-06-12 20:40:55 +08:00
Justin Lin
8983b01b30 c-style for loop 2019-06-12 20:31:20 +08:00
Justin Lin
7c59a3e11b c-style for loop 2019-06-12 20:29:51 +08:00
Justin Lin
f433a79c31 c-style for loop 2019-06-12 20:28:18 +08:00
Justin Lin
700f46bfef c-style for loop 2019-06-12 13:36:48 +08:00
Justin Lin
e34bc73def c-style for loop 2019-06-12 13:35:21 +08:00
Justin Lin
cec42209f2 c-style for loop 2019-06-12 13:33:43 +08:00
Justin Lin
758b14715f c-style for loop 2019-06-12 13:30:34 +08:00
Justin Lin
f89794e3cc modify use case 2019-06-12 13:18:26 +08:00
Justin Lin
edd022bca2 modify use case 2019-06-12 13:08:07 +08:00
Justin Lin
c5c9ca40c9 update README 2019-06-12 09:16:54 +08:00
Justin Lin
423fc36f1c c-style for loop 2019-06-12 09:06:36 +08:00
Justin Lin
283b091c7c use built-in is_undef 2019-06-12 08:59:54 +08:00
Justin Lin
bf0601eaef never used 2019-06-12 08:58:32 +08:00
Justin Lin
8c4d2b5333 c-style for loop 2019-06-12 08:42:10 +08:00
Justin Lin
88b0868358 c-style for loop 2019-06-12 08:39:54 +08:00
Justin Lin
68ad185712 add test_shape_arc 2019-06-12 08:37:00 +08:00
Justin Lin
2e1def3556 use c-style for loop 2019-06-12 08:32:52 +08:00
Justin Lin
9a2e66f999 refactor 2019-06-12 08:23:40 +08:00
Justin Lin
e1985e85b0 multify directly 2019-06-12 08:20:16 +08:00
Justin Lin
c31145be3b modify message 2019-06-12 08:18:54 +08:00
Justin Lin
fee00580be modify use case 2019-06-12 08:17:50 +08:00
Justin Lin
5a836b02d6 modify use case 2019-06-12 07:36:15 +08:00
Justin Lin
bec05fb5b4 modify use_case 2019-06-12 07:32:26 +08:00
Justin Lin
15c1a98b8d update README 2019-06-11 15:36:42 +08:00
Justin Lin
e170918a5d update README 2019-06-11 15:35:31 +08:00
Justin Lin
5a7c13a548 change expected 2019-06-11 15:31:56 +08:00
Justin Lin
f34f2e0bbf not necessary 2019-06-11 15:30:45 +08:00
Justin Lin
f47267c656 annoying float errors XD 2019-06-11 15:28:16 +08:00
Justin Lin
2e2079a323 use built-in assert 2019-06-11 15:15:52 +08:00
Justin Lin
627909fc9e use new assertEqualPoints 2019-06-11 14:52:44 +08:00
Justin Lin
fcddf7b187 refactor 2019-06-11 14:49:12 +08:00
Justin Lin
eaeb0d1e28 refactor 2019-06-11 14:38:51 +08:00
Justin Lin
6b64ca01ab refactor to use assertEqualNum 2019-06-11 14:32:21 +08:00
Justin Lin
df0f293825 use built-in assert 2019-06-11 13:49:31 +08:00
Justin Lin
37e272e333 use 0 directly 2019-06-11 09:30:07 +08:00
Justin Lin
799790932e use built-in angle 2019-06-11 09:26:26 +08:00
Justin Lin
a56d443686 use built-in PI 2019-06-11 09:02:41 +08:00
Justin Lin
d581e60678 use built-in PI 2019-06-11 08:58:50 +08:00
Justin Lin
d1ae9174a9 use built-in is_num 2019-06-11 08:39:57 +08:00
Justin Lin
9d63c4ffeb not necessary 2019-06-11 08:27:11 +08:00
Justin Lin
db6c77a523 use is_num 2019-06-11 08:26:47 +08:00
224 changed files with 7689 additions and 2678 deletions

View File

@@ -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.**
![dotSCAD](WhirlingTaiwan.JPG) ![dotSCAD](TaiwaneseBlackBear.JPG)
[![license/LGPL](https://img.shields.io/badge/license-LGPL-blue.svg)](https://github.com/JustinSDK/lib-openscad/blob/master/LICENSE) [![license/LGPL](https://img.shields.io/badge/license-LGPL-blue.svg)](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).

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

114
all/dotSCAD.scad Normal file
View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -4,8 +4,6 @@ Uses spherical coordinate system to create a crystal ball.
![Spherical coordinates (r, θ, φ) often used in mathematics](https://upload.wikimedia.org/wikipedia/commons/d/dc/3D_Spherical_2.svg) ![Spherical coordinates (r, θ, φ) often used in mathematics](https://upload.wikimedia.org/wikipedia/commons/d/dc/3D_Spherical_2.svg)
Dependencies: `rotate_p`, `cross_sections`, `polysections`, `ring_extrude`, `shape_pie`.
## Parameters ## Parameters
- `radius` : The radial distance r. - `radius` : The radial distance r.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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");
}
![log](images/lib-log-1.JPG)
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");
}
![log](images/lib-log-2.JPG)

23
docs/lib-m_mirror.md Normal file
View 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]);
![m_mirror](images/lib-m_mirror-1.JPG)

View File

@@ -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);
![m_multiply](images/lib-m_multiply-1.JPG)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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
View 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]);
![m_mirror](images/lib-m_mirror-1.JPG)

View File

@@ -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];

View File

@@ -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])

View File

@@ -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]))

View File

@@ -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);
![m_translation](images/lib-m_translation-1.JPG) ![m_translation](images/lib-m_translation-1.JPG)

18
docs/lib2-parse_number.md Normal file
View 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

View File

@@ -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
View 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);
}
![px_circle](images/lib2-px_circle-1.JPG)
include <pixel/px_circle.scad>;
for(pt = px_circle(10, filled = true)) {
translate(pt)
linear_extrude(1, scale = 0.5)
square(1, center = true);
}
![px_circle](images/lib2-px_circle-2.JPG)

33
docs/lib2-px_cylinder.md Normal file
View 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);
}
![px_cylinder](images/lib2-px_cylinder-1.JPG)
include <pixel/px_cylinder.scad>;
for(pt = px_cylinder([20, 15], h = 10, thickness = 3)) {
translate(pt)
cube(1, center = true);
}
![px_cylinder](images/lib2-px_cylinder-2.JPG)

31
docs/lib2-px_line.md Normal file
View 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);
}
![px_line](images/lib2-px_line-1.JPG)
include <pixel/px_line.scad>;
for(pt = px_line([-10, 0, -10], [20, 50, 10])) {
translate(pt)
cube(1, center = true);
}
![px_line](images/lib2-px_line-2.JPG)

39
docs/lib2-px_polygon.md Normal file
View 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);
}
![px_polygon](images/lib2-px_polygon-1.JPG)

55
docs/lib2-px_polyline.md Normal file
View 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);
}
![px_polyline](images/lib2-px_polyline-1.JPG)
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);
}
}
![px_polyline](images/lib2-px_polyline-2.JPG)

22
docs/lib2-px_sphere.md Normal file
View 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);
}
![px_sphere](images/lib2-px_sphere-1.JPG)

16
docs/lib2-reverse.md Normal file
View 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
View 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
View 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)
);

View File

@@ -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"]

View File

@@ -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"

View File

@@ -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
![turtle2d](images/lib-turtle2d-1.JPG) ![turtle2d](images/lib-turtle2d-1.JPG)
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;

View File

@@ -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
![turtle3d](images/lib-turtle3d-1.JPG) ![turtle3d](images/lib-turtle3d-1.JPG)
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,

View 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]]));
}

View 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
View 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
View 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
View 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);

View 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);
}

View 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
View 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
View 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
View 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);

View 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);

View 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);

View File

@@ -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];

View File

@@ -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);

View File

@@ -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),

View 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]]] : []
);

View File

@@ -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)

View File

@@ -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]
] ]

View File

@@ -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)

View File

@@ -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)
], ],

View File

@@ -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);

View File

@@ -0,0 +1 @@
function __to_degree(phi) = 180 / PI * phi;

View File

@@ -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]]
] ]

View File

@@ -1 +0,0 @@
function __is_float(value) = value + 0 != undef;

View File

@@ -1 +0,0 @@
function __is_vector(value) = !(value >= "") && len(value) != undef;

View File

@@ -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]]] : []
);

View File

@@ -1,6 +0,0 @@
function __reverse(vt) =
let(leng = len(vt))
[
for(i = [0:leng - 1])
vt[leng - 1 - i]
];

View File

@@ -1 +0,0 @@
function __to_degree(phi) = 180 / 3.14159 * phi;

87
src/all/dotSCAD.scad Normal file
View 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>;

View File

@@ -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) {
} }

View File

@@ -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));

View File

@@ -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])])

View File

@@ -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)

View File

@@ -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)])
) )

View File

@@ -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(

View File

@@ -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]]
) )

Some files were not shown because too many files have changed in this diff Show More