mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 09:44:16 +02:00
add polar_zonohedra
This commit is contained in:
33
src/polyhedra/geom_polar_zonohedra.scad
Normal file
33
src/polyhedra/geom_polar_zonohedra.scad
Normal 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];
|
17
src/polyhedra/polar_zonohedra.scad
Normal file
17
src/polyhedra/polar_zonohedra.scad
Normal 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]);
|
||||||
|
}
|
Reference in New Issue
Block a user