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
2022-01-26 16:51:44 +08:00
parent dd632d5845
commit 0409c35375
8 changed files with 15 additions and 15 deletions

View File

@@ -2,7 +2,7 @@ use <voronoi/vrn_sphere.scad>;
use <polyline_join.scad>;
use <sweep.scad>;
use <fibonacci_lattice.scad>;
use <experimental/convex_center_p.scad>;
use <experimental/convex_centroid.scad>;
use <experimental/rand_pts_sphere.scad>;
n = 60;
@@ -23,7 +23,7 @@ module voronoi_sphere(pts, region_hollow, region_offset, region_height) {
for(i = [0:len(cells) - 1]) {
cell = cells[i];
cell_cp = convex_center_p(cell);
cell_cp = convex_centroid(cell);
cell_inner = [
for(p = cell)
let(
@@ -44,7 +44,7 @@ module voronoi_sphere(pts, region_hollow, region_offset, region_height) {
];
if(region_hollow) {
cell2_cp = convex_center_p(cell2);
cell2_cp = convex_centroid(cell2);
cell2_inner = [
for(p = cell2)
let(

View File

@@ -1,3 +0,0 @@
use <util/sum.scad>;
function convex_center_p(points) = sum(points) / len(points);

View File

@@ -0,0 +1,3 @@
use <util/sum.scad>;
function convex_centroid(points) = sum(points) / len(points);

View File

@@ -1,9 +1,9 @@
use <util/sort.scad>;
use <experimental/convex_center_p.scad>;
use <experimental/convex_centroid.scad>;
function convex_ct_clk_order(points) =
let(
cpt = convex_center_p(points),
cpt = convex_centroid(points),
pts_as = [for(p = points) [p, atan2(p[1] - cpt[1], p[0] - cpt[0])]],
sorted = sort(pts_as, by = "idx", idx = 1)
)

View File

@@ -1,8 +1,8 @@
use <experimental/convex_center_p.scad>;
use <experimental/convex_centroid.scad>;
function tri_bisectors(points) =
let(
orthocentre = convex_center_p(points),
orthocentre = convex_centroid(points),
m1 = (points[0] + points[1]) / 2,
m2 = (points[1] + points[2]) / 2,
m3 = (points[2] + points[0]) / 2

View File

@@ -1,3 +0,0 @@
use <../../util/sum.scad>;
function _convex_center_p(points) = sum(points) / len(points);

View File

@@ -0,0 +1,3 @@
use <../../util/sum.scad>;
function _convex_centroid(points) = sum(points) / len(points);

View File

@@ -1,9 +1,9 @@
use <../../util/sort.scad>;
use <_convex_center_p.scad>;
use <_convex_centroid.scad>;
function _convex_ct_clk_order(points) =
let(
cpt = _convex_center_p(points),
cpt = _convex_centroid(points),
pts_as = [for(p = points) [p, atan2(p[1] - cpt[1], p[0] - cpt[0])]],
sorted = sort(pts_as, by = "idx", idx = 1)
)