1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00
This commit is contained in:
Justin Lin 2021-04-25 17:42:49 +08:00
parent 08060db897
commit ef6a1d1d1c
2 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,7 @@
use <golden_spiral.scad>;
use <ptf/ptf_rotate.scad>;
use <triangle/tri_delaunay.scad>;
use <triangle/tri_incentre.scad>;
use <triangle/tri_incenter.scad>;
use <util/dedup.scad>;
spirals = 2;
@ -35,7 +35,7 @@ module delaunay_fibonacci() {
cells = tri_delaunay(pts, ret = "TRI_SHAPES");
for(i = [0:len(cells) - 1]) {
cell = cells[i];
p = tri_incentre(cell);
p = tri_incenter(cell);
color(rands(0, 1, 3))
translate(p)

View File

@ -0,0 +1,13 @@
function tri_incenter(shape_pts) =
let(
pa = shape_pts[0],
pb = shape_pts[1],
pc = shape_pts[2],
a = norm(pb - pc),
b = norm(pc - pa),
c = norm(pa - pb)
)
[
(a * pa[0] + b * pb[0] + c * pc[0]),
(a * pa[1] + b * pb[1] + c * pc[1])
] / (a + b + c);