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