mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-07 15:26:39 +02:00
S pr is always 1
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use <experimental/lsystem2.scad>;
|
use <experimental/lsystem2.scad>;
|
||||||
use <line2d.scad>;
|
use <line2d.scad>;
|
||||||
|
|
||||||
for(line = gosper_star()) {
|
for(line = plant()) {
|
||||||
line2d(
|
line2d(
|
||||||
line[0],
|
line[0],
|
||||||
line[1],
|
line[1],
|
||||||
@@ -28,7 +28,7 @@ function plant(n = 4, angle = 25, leng = 1, heading = 0, start = [0, 0]) =
|
|||||||
["F", "FF"]
|
["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]) =
|
function koch_curve(n = 4, angle = 60, leng = 1, heading = 0, start = [0, 0]) =
|
||||||
let(
|
let(
|
||||||
|
@@ -13,7 +13,7 @@ function _join(strs) =
|
|||||||
function c_or_v(c, v, rand_n, rule, rule_pr, leng, i = 0) =
|
function c_or_v(c, v, rand_n, rule, rule_pr, leng, i = 0) =
|
||||||
i == leng ? c : (
|
i == leng ? c : (
|
||||||
let(idx = search([v[i]], rule, num_returns_per_match=0, index_col_num = 1)[0][0])
|
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) =
|
function _derive1_p(base, rule, rule_pr) =
|
||||||
|
Reference in New Issue
Block a user