1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00
This commit is contained in:
Justin Lin
2020-09-20 20:45:22 +08:00
parent a1686c4fea
commit 182c6369d5

View File

@@ -6,7 +6,9 @@ segs_per_side = 20;
line_fn = 5; line_fn = 5;
model = "Tetrahedron"; // [Tetrahedron, Base, Both] model = "Tetrahedron"; // [Tetrahedron, Base, Both]
module lines_between(side1, side2, thickness, segs) {
module string_tetrahedron(leng, thickness, segs_per_side, line_fn) {
module lines_between(side1, side2, thickness, segs) {
function pts(p1, p2, segs) = function pts(p1, p2, segs) =
let( let(
p = p2 - p1, p = p2 - p1,
@@ -21,12 +23,12 @@ module lines_between(side1, side2, thickness, segs) {
for(i = [0:len(pts1) - 1]) { for(i = [0:len(pts1) - 1]) {
hull_polyline3d(points = [pts1[i], pts2[i]], thickness = thickness); hull_polyline3d(points = [pts1[i], pts2[i]], thickness = thickness);
} }
} }
function height(leng) = function height(leng) =
leng * sqrt(1 - 4 / 9 * pow(sin(60), 2)); leng * sqrt(1 - 4 / 9 * pow(sin(60), 2));
function vts(leng) = function vts(leng) =
let( let(
half_leng = leng / 2, half_leng = leng / 2,
center_y = half_leng * tan(30), center_y = half_leng * tan(30),
@@ -36,7 +38,6 @@ function vts(leng) =
vt4 = [0, 0, height(leng)] vt4 = [0, 0, height(leng)]
) [vt1, vt2, vt3, vt4]; ) [vt1, vt2, vt3, vt4];
module string_tetrahedron(leng, thickness, segs_per_side, line_fn) {
$fn = line_fn; $fn = line_fn;
half_leng = leng / 2; half_leng = leng / 2;