mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 04:51:26 +02:00
refactor
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
**/
|
||||
|
||||
use <bezier_curve.scad>;
|
||||
use <matrix/m_transpose.scad>;
|
||||
|
||||
function bezier_surface(t_step, ctrl_pts) =
|
||||
let(
|
||||
@@ -18,18 +19,11 @@ function bezier_surface(t_step, ctrl_pts) =
|
||||
bezier_curve(t_step, ctrl_pts[i])
|
||||
],
|
||||
leng_pts0 = len(pts[0]),
|
||||
leng_pts = len(pts),
|
||||
sf = [for(x = 0; x < leng_pts0; x = x + 1)
|
||||
bezier_curve(
|
||||
t_step,
|
||||
[for(y = 0; y < leng_pts; y = y + 1) pts[y][x]]
|
||||
)
|
||||
]
|
||||
leng_pts = len(pts)
|
||||
)
|
||||
[
|
||||
for(y = 0; y < len(sf[0]); y = y + 1)
|
||||
[
|
||||
for(x = 0; x < len(sf); x = x + 1)
|
||||
sf[x][y]
|
||||
]
|
||||
];
|
||||
m_transpose([for(x = 0; x < leng_pts0; x = x + 1)
|
||||
bezier_curve(
|
||||
t_step,
|
||||
[for(y = 0; y < leng_pts; y = y + 1) pts[y][x]]
|
||||
)
|
||||
]);
|
@@ -8,6 +8,8 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <matrix/m_transpose.scad>;
|
||||
|
||||
function sf_splines(ctrl_pts, row_spline, column_spline) =
|
||||
let(
|
||||
leng_ctrl_pts = len(ctrl_pts),
|
||||
@@ -17,16 +19,9 @@ function sf_splines(ctrl_pts, row_spline, column_spline) =
|
||||
row_spline(ctrl_pts[r])
|
||||
],
|
||||
leng_r_pts0 = len(r_pts[0]),
|
||||
leng_r_pts = len(r_pts),
|
||||
sf = [
|
||||
for(c = 0; c < leng_r_pts0; c = c + 1)
|
||||
cspline([for(r = 0; r < leng_r_pts; r = r + 1) r_pts[r][c]])
|
||||
]
|
||||
leng_r_pts = len(r_pts)
|
||||
)
|
||||
[
|
||||
for(y = 0; y < len(sf[0]); y = y + 1)
|
||||
[
|
||||
for(x = 0; x < len(sf); x = x + 1)
|
||||
sf[x][y]
|
||||
]
|
||||
];
|
||||
m_transpose([
|
||||
for(c = 0; c < leng_r_pts0; c = c + 1)
|
||||
cspline([for(r = 0; r < leng_r_pts; r = r + 1) r_pts[r][c]])
|
||||
]);
|
||||
|
Reference in New Issue
Block a user