1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-14 19:19:47 +01:00

add hexahedron

This commit is contained in:
Justin Lin 2021-09-22 16:56:46 +08:00
parent 5374999967
commit 57da4b39ad
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,19 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>;
function geom_hexahedron(radius, detail = 0, quick_mode = true) =
let(
t = 1 / sqrt(3),
hexahedron_points = [
[t, t, t], [-t, t, t], [-t, -t, t], [t, -t, t],
[t, t, -t], [-t, t, -t], [-t, -t, -t], [t, -t, -t]
],
hexahedron_faces = [
[0, 7, 3], [0, 4, 7],
[1, 4, 0], [1, 5, 4],
[2, 6, 5], [2, 5, 1],
[3, 7, 6], [3, 6, 2],
[0, 3, 2], [0, 2, 1],
[5, 6, 7], [5, 7, 4]
]
)
_geom_platonic_polyhedra(hexahedron_points, hexahedron_faces, radius, detail, quick_mode);

View File

@ -0,0 +1,6 @@
use <experimental/geom_hexahedron.scad>;
module hexahedron(radius, detail = 0, quick_mode = true) {
points_faces = geom_hexahedron(radius, detail, quick_mode);
polyhedron(points_faces[0], points_faces[1]);
}