1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-29 20:08:21 +01:00

S pr is always 1

This commit is contained in:
Justin Lin 2020-04-14 13:39:17 +08:00
parent 4dc3edf7e2
commit ee6dcf04c0
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
use <experimental/lsystem2.scad>;
use <line2d.scad>;
for(line = gosper_star()) {
for(line = plant()) {
line2d(
line[0],
line[1],
@ -28,7 +28,7 @@ function plant(n = 4, angle = 25, leng = 1, heading = 0, start = [0, 0]) =
["F", "FF"]
]
)
lsystem2(rule, n, angle, leng, heading, start);
lsystem2(rule, n, angle, leng, heading, start, rule_pr = [1, 1, 1]);
function koch_curve(n = 4, angle = 60, leng = 1, heading = 0, start = [0, 0]) =
let(

View File

@ -13,7 +13,7 @@ function _join(strs) =
function c_or_v(c, v, rand_n, rule, rule_pr, leng, i = 0) =
i == leng ? c : (
let(idx = search([v[i]], rule, num_returns_per_match=0, index_col_num = 1)[0][0])
rand_n < rule_pr[idx - 1] ? v[i] : c_or_v(c, v, rand_n, rule, rule_pr, leng, i + 1)
rand_n < rule_pr[idx] ? v[i] : c_or_v(c, v, rand_n, rule, rule_pr, leng, i + 1)
);
function _derive1_p(base, rule, rule_pr) =