1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-06 14:56:47 +02:00

add polyhedra

This commit is contained in:
Justin Lin
2021-10-06 15:54:20 +08:00
parent f7e81a78e3
commit d6affc1ff5
12 changed files with 36 additions and 17 deletions

View File

@@ -7,4 +7,4 @@ to_do:
- doc: sf add convexity - doc: sf add convexity
- new: polyline_join, superellipsoid, select, dodecahedron, hexahedron, icosahedron, octahedron, tetrahedron - new: polyline_join, select, polyhedra/superellipsoid, polyhedra/dodecahedron, polyhedra/hexahedron, polyhedra/icosahedron, polyhedra/octahedron, polyhedra/tetrahedron

View File

@@ -1,8 +1,27 @@
use <__comm__/_pt3_hash.scad>; use <../../__comm__/_pt3_hash.scad>;
use <util/map/hashmap.scad>; use <../../util/map/hashmap.scad>;
use <util/map/hashmap_put.scad>; use <../../util/map/hashmap_put.scad>;
use <util/map/hashmap_get.scad>; use <../../util/map/hashmap_get.scad>;
use <experimental/tri_subdivide.scad>;
function _tri_subdivide(points) =
let(
p0 = points[0],
p1 = points[1],
p2 = points[2],
m0 = (p0 + p1) / 2,
m1 = (p1 + p2) / 2,
m2 = (p2 + p0) / 2
)
[
[p0, m0, m2],
[m0, p1, m1],
[m1, p2, m2],
[m0, m1, m2]
];
function tri_subdivide(points, n = 1) =
n == 1 ? _tri_subdivide(points) :
[for(tri = tri_subdivide(points, n - 1)) each _tri_subdivide(tri)];
function _geom_prj2sphere(t, r) = [for(p = t) p / norm(p) * r]; function _geom_prj2sphere(t, r) = [for(p = t) p / norm(p) * r];

View File

@@ -1,4 +1,4 @@
use <experimental/geom_dodecahedron.scad>; use <geom_dodecahedron.scad>;
module dodecahedron(radius, detail = 0, quick_mode = true) { module dodecahedron(radius, detail = 0, quick_mode = true) {
points_faces = geom_dodecahedron(radius, detail, quick_mode); points_faces = geom_dodecahedron(radius, detail, quick_mode);

View File

@@ -1,4 +1,4 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>; use <_impl/_geom_platonic_polyhedra.scad>;
function geom_dodecahedron(radius, detail = 0, quick_mode = true) = function geom_dodecahedron(radius, detail = 0, quick_mode = true) =
let( let(

View File

@@ -1,4 +1,4 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>; use <_impl/_geom_platonic_polyhedra.scad>;
function geom_hexahedron(radius, detail = 0, quick_mode = true) = function geom_hexahedron(radius, detail = 0, quick_mode = true) =
let( let(

View File

@@ -1,4 +1,4 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>; use <_impl/_geom_platonic_polyhedra.scad>;
function geom_icosahedron(radius, detail = 0, quick_mode = true) = function geom_icosahedron(radius, detail = 0, quick_mode = true) =
let( let(

View File

@@ -1,4 +1,4 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>; use <_impl/_geom_platonic_polyhedra.scad>;
function geom_octahedron(radius, detail = 0, quick_mode = true) = function geom_octahedron(radius, detail = 0, quick_mode = true) =
let( let(

View File

@@ -1,4 +1,4 @@
use <experimental/_impl/_geom_platonic_polyhedra.scad>; use <_impl/_geom_platonic_polyhedra.scad>;
function geom_tetrahedron(radius, detail = 0, quick_mode = true) = function geom_tetrahedron(radius, detail = 0, quick_mode = true) =
let( let(

View File

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

View File

@@ -1,4 +1,4 @@
use <experimental/geom_icosahedron.scad>; use <geom_icosahedron.scad>;
module icosahedron(radius, detail = 0, quick_mode = true) { module icosahedron(radius, detail = 0, quick_mode = true) {
points_faces = geom_icosahedron(radius, detail, quick_mode); points_faces = geom_icosahedron(radius, detail, quick_mode);

View File

@@ -1,5 +1,5 @@
use <__comm__/__frags.scad>; use <../__comm__/__frags.scad>;
use <sweep.scad>; use <../sweep.scad>;
// e = 0; // e = 0;
// n = 0; // n = 0;

View File

@@ -1,4 +1,4 @@
use <experimental/geom_tetrahedron.scad>; use <geom_tetrahedron.scad>;
module tetrahedron(radius, detail = 0, quick_mode = true) { module tetrahedron(radius, detail = 0, quick_mode = true) {
points_faces = geom_tetrahedron(radius, detail, quick_mode); points_faces = geom_tetrahedron(radius, detail, quick_mode);