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

add quarter param

This commit is contained in:
Justin Lin 2022-05-09 15:42:24 +08:00
parent e932cdaa0f
commit 68db8eeb6c

View File

@ -4,16 +4,18 @@ use <noise/nz_worley3.scad>;
use <shape_circle.scad>; use <shape_circle.scad>;
use <ptf/ptf_rotate.scad>; use <ptf/ptf_rotate.scad>;
quarter = 1;
detail = 4; detail = 4;
seed = 5; seed = 5;
rock_horn(detail, seed); rock_horn(quarter, detail, seed);
module rock_horn(detail, seed) { module rock_horn(quarter, detail, seed) {
$fn = 64 * detail; $fn = 64 * detail;
point_distance = 1 / detail; point_distance = 1 / detail;
scale = 4; scale = 4 * quarter;
radius = 6; radius = 6;
thickness = 1.5; thickness = 1.5;
@ -21,14 +23,14 @@ module rock_horn(detail, seed) {
pts_angles = golden_spiral( pts_angles = golden_spiral(
from = 8, from = 8,
to = 8, to = 7 + quarter,
point_distance = point_distance, point_distance = point_distance,
rt_dir = "CT_CLK" rt_dir = "CT_CLK"
); );
leng = len(pts_angles); leng = len(pts_angles);
scale_step = scale / leng; scale_step = scale / leng;
h_step = 2 * scale * radius / leng; h_step = 2 * point_distance;
sections = [ sections = [
for(i = [0:leng - 1]) for(i = [0:leng - 1])
let( let(
@ -39,7 +41,7 @@ module rock_horn(detail, seed) {
nzp = [p.x * s, p.y * s, h_step * i], nzp = [p.x * s, p.y * s, h_step * i],
nz = nz_worley3(nzp.x, nzp.y, nzp.z, seed, radius, "border") nz = nz_worley3(nzp.x, nzp.y, nzp.z, seed, radius, "border")
) )
[nzp.x, nzp.y, 0] + [sign(p.x), sign(p.y), 0] * nz[3] / scale [nzp.x, nzp.y, 0] + [sign(p.x), sign(p.y), 0] * nz[3] / 4
] ]
) )
[ [
@ -49,7 +51,7 @@ module rock_horn(detail, seed) {
p - [sign(p.x), sign(p.y), 0] * thickness p - [sign(p.x), sign(p.y), 0] * thickness
] ]
] ]
] / scale; ] / 4;
rx = [90, 0, 0]; rx = [90, 0, 0];
sweep( sweep(
@ -69,3 +71,4 @@ module rock_horn(detail, seed) {
"HOLLOW" "HOLLOW"
); );
} }