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

add tri_incentre

This commit is contained in:
Justin Lin
2021-04-25 17:17:13 +08:00
parent 76e6ecaa6c
commit a9b088af90

View File

@@ -0,0 +1,13 @@
function tri_incentre(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);