mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-27 08:25:45 +02:00
add rock
This commit is contained in:
@@ -6,6 +6,7 @@ use <util/choose.scad>;
|
|||||||
use <experimental/tiles_wfc.scad>;
|
use <experimental/tiles_wfc.scad>;
|
||||||
use <rounded_square.scad>;
|
use <rounded_square.scad>;
|
||||||
use <box_extrude.scad>;
|
use <box_extrude.scad>;
|
||||||
|
use <polyhedron_hull.scad>;
|
||||||
|
|
||||||
rows = 6;
|
rows = 6;
|
||||||
columns = 6;
|
columns = 6;
|
||||||
@@ -89,6 +90,27 @@ module random_town_square(rows, columns, tileW, layerH) {
|
|||||||
square(tileW);
|
square(tileW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module rock(width = 1) {
|
||||||
|
n = 10 * rands(1, 1.25, 1)[0];
|
||||||
|
r = width / 2 * rands(1, 1.25, 1)[0];
|
||||||
|
theta = rands(0, 359, n);
|
||||||
|
phi = rands(0, 359, n);
|
||||||
|
|
||||||
|
polyhedron_hull([
|
||||||
|
for(i = [0:n - 1])
|
||||||
|
let(z = r * cos(phi[i]))
|
||||||
|
[r * cos(theta[i]), r * sin(theta[i]), z >= 0 ? z : 0]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module df_door(h) {
|
||||||
|
dim = [(tileW + rand()) * 0.2, tileW];
|
||||||
|
linear_extrude(h * 0.8) {
|
||||||
|
square(dim, center = true);
|
||||||
|
rotate(90)
|
||||||
|
square(dim, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// F
|
// F
|
||||||
module floor(tileW, height) {
|
module floor(tileW, height) {
|
||||||
base(tileW, height);
|
base(tileW, height);
|
||||||
@@ -99,24 +121,28 @@ module random_town_square(rows, columns, tileW, layerH) {
|
|||||||
if(choose([true, false, false])) {
|
if(choose([true, false, false])) {
|
||||||
translate([halfW, halfW, 0])
|
translate([halfW, halfW, 0])
|
||||||
rotate(choose([0, 90]))
|
rotate(choose([0, 90]))
|
||||||
|
|
||||||
|
if(choose([true, false])) {
|
||||||
difference() {
|
difference() {
|
||||||
translate([0, 0, h])
|
translate([0, 0, h])
|
||||||
mirror([0, 0, 1])
|
mirror([0, 0, 1])
|
||||||
if(choose([true, false])) {
|
|
||||||
box_extrude(h, shell_thickness = tileW / 10)
|
box_extrude(h, shell_thickness = tileW / 10)
|
||||||
rounded_square(tileW * 0.8, 1, center = true);
|
rounded_square(tileW * 0.8, 1, center = true);
|
||||||
|
df_door(h);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
|
else if(choose([true, false])) {
|
||||||
|
difference() {
|
||||||
|
translate([0, 0, h])
|
||||||
|
mirror([0, 0, 1])
|
||||||
linear_extrude(h)
|
linear_extrude(h)
|
||||||
circle(tileW * 0.5, $fn = choose([4, 8, 12, 48]));
|
circle(tileW * 0.5, $fn = choose([4, 8, 12, 48]));
|
||||||
|
df_door(h);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
linear_extrude(h * 0.8)
|
else {
|
||||||
square([tileW * 0.2 + rand() * 0.2, tileW], center = true);
|
translate([0, 0, height])
|
||||||
|
rock(halfW * 1.5);
|
||||||
rotate(90)
|
|
||||||
linear_extrude(h * 0.8)
|
|
||||||
square([tileW * 0.2 + rand() * 0.2, tileW], center = true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user