1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-10 00:36:40 +02:00

add polar_zonohedra

This commit is contained in:
Justin Lin
2021-12-02 10:47:32 +08:00
parent abd287b29e
commit 22dce8fee2
2 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
use <../util/sum.scad>;
use <../util/flat.scad>;
function vertex(i, j, n, theta) =
i > j ? [0, 0, 0] :
sum([
for(k = [i:j])
let(
cosa = cos(theta),
a_i_n = 360 * k / n
)
[cosa * cos(a_i_n), cosa * sin(a_i_n), sin(theta)]
]);
function rhombi(i, j, n, theta) = [
vertex(i, j, n, theta),
vertex(i + 1, j, n, theta),
vertex(i + 1, -1 + j, n, theta),
vertex(i, -1 + j, n, theta)
];
function geom_polar_zonohedra(n, theta = 35.5) =
let(
points = flat([
for(i = [0:n - 1], j = [i + 1:n + i - 1])
rhombi(i, j, n, theta)
]),
faces = [
for(i = [0:len(points) / 4 - 1])
[for(j = [0:3]) i * 4 + j]
]
)
[points, faces];

View File

@@ -0,0 +1,17 @@
// http://archive.bridgesmathart.org/2021/bridges2021-7.pdf
// use <util/sum.scad>;
// use <util/flat.scad>;
// use <polyhedra/polar_zonohedra.scad>;
// for(n = [3:8]) {
// translate([0.5 * n * (n - 3), 0, 0])
// polar_zonohedra(n);
// }
use <geom_polar_zonohedra.scad>;
module polar_zonohedra(n, theta = 35.5) {
points_faces = geom_polar_zonohedra(n, theta);
polyhedron(points_faces[0], points_faces[1]);
}