mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-01 04:20:27 +02:00
rename
This commit is contained in:
@@ -28,29 +28,28 @@ function _corner_ctrl_pts(round_d, p1, p2, p3) =
|
||||
function _bezier_corner(round_d, t_step, p1, p2, p3) =
|
||||
bezier_curve(t_step, _corner_ctrl_pts(round_d, p1, p2, p3));
|
||||
|
||||
function _recursive_bezier_smooth(pts, round_d, t_step, leng, angle_threshold) =
|
||||
function _bezier_smooth_corners(pts, round_d, t_step, leng, angle_threshold) =
|
||||
let(end_i = leng - 2)
|
||||
[
|
||||
for(i = 0; i < end_i; i = i + 1)
|
||||
each
|
||||
angle_between(pts[i] - pts[i + 1], pts[i + 1] - pts[i + 2]) > angle_threshold ?
|
||||
_bezier_corner(round_d, t_step, pts[i], pts[i + 1], pts[i + 2]) :
|
||||
[pts[i + 1]]
|
||||
each angle_between(pts[i] - pts[i + 1], pts[i + 1] - pts[i + 2]) > angle_threshold ?
|
||||
_bezier_corner(round_d, t_step, pts[i], pts[i + 1], pts[i + 2]) :
|
||||
[pts[i + 1]]
|
||||
];
|
||||
|
||||
function _bezier_smooth_impl(path_pts, round_d, t_step, closed, angle_threshold) =
|
||||
let(
|
||||
pts = len(path_pts[0]) == 3 ? path_pts : [for(p = path_pts) __to3d(p)],
|
||||
leng = len(pts),
|
||||
middle_pts = _recursive_bezier_smooth(pts, round_d, t_step, leng, angle_threshold),
|
||||
middle_pts = _bezier_smooth_corners(pts, round_d, t_step, leng, angle_threshold),
|
||||
pth_pts = closed ?
|
||||
concat(
|
||||
_recursive_bezier_smooth(
|
||||
_bezier_smooth_corners(
|
||||
[pts[leng - 1], pts[0], pts[1]],
|
||||
round_d, t_step, 3, angle_threshold
|
||||
),
|
||||
middle_pts,
|
||||
_recursive_bezier_smooth(
|
||||
_bezier_smooth_corners(
|
||||
[pts[leng - 2], pts[leng - 1], pts[0]],
|
||||
round_d, t_step, 3, angle_threshold
|
||||
)
|
||||
|
Reference in New Issue
Block a user