mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 18:24:28 +02:00
added pascal tri
This commit is contained in:
@@ -13,7 +13,17 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
function _combi(n, k) =
|
function _combi(n, k) =
|
||||||
k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k);
|
let(
|
||||||
|
bi_coef = [
|
||||||
|
[1], // n = 0: for padding
|
||||||
|
[1,1], // n = 1: for Linear curves, how about drawing a line directly?
|
||||||
|
[1,2,1], // n = 2: for Quadratic curves
|
||||||
|
[1,3,3,1] // n = 3: for Cubic Bézier curves
|
||||||
|
]
|
||||||
|
)
|
||||||
|
n < len(bi_coef) ? bi_coef[n][k] : (
|
||||||
|
k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k)
|
||||||
|
);
|
||||||
|
|
||||||
function bezier_curve_coordinate(t, pn, n, i = 0) =
|
function bezier_curve_coordinate(t, pn, n, i = 0) =
|
||||||
i == n + 1 ? 0 :
|
i == n + 1 ? 0 :
|
||||||
|
Reference in New Issue
Block a user