mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
fix beziers to handle removal of vnf= option in vnf_vertex_array
This commit is contained in:
parent
ef5e924e54
commit
80c6e0666d
1 changed files with 6 additions and 14 deletions
20
beziers.scad
20
beziers.scad
|
@ -1124,7 +1124,7 @@ function is_patch(x) =
|
||||||
|
|
||||||
// Function: bezier_patch()
|
// Function: bezier_patch()
|
||||||
// Usage:
|
// Usage:
|
||||||
// vnf = bezier_patch(patch, [splinesteps], [vnf=], [style=]);
|
// vnf = bezier_patch(patch, [splinesteps], [style=]);
|
||||||
// Topics: Bezier Patches
|
// Topics: Bezier Patches
|
||||||
// See Also: bezier_points(), bezier_curve(), bezier_path(), bezier_patch_points(), bezier_triangle_point()
|
// See Also: bezier_points(), bezier_curve(), bezier_path(), bezier_patch_points(), bezier_triangle_point()
|
||||||
// Description:
|
// Description:
|
||||||
|
@ -1137,7 +1137,6 @@ function is_patch(x) =
|
||||||
// patch = The rectangular or triangular array of endpoints and control points for this bezier patch.
|
// patch = The rectangular or triangular array of endpoints and control points for this bezier patch.
|
||||||
// splinesteps = Number of steps to divide each bezier segment into. For rectangular patches you can specify [XSTEPS,YSTEPS]. Default: 16
|
// splinesteps = Number of steps to divide each bezier segment into. For rectangular patches you can specify [XSTEPS,YSTEPS]. Default: 16
|
||||||
// ---
|
// ---
|
||||||
// vnf = Vertices'n'Faces [VNF structure](vnf.scad) to add new vertices and faces to. Default: empty VNF
|
|
||||||
// style = The style of subdividing the quads into faces. Valid options are "default", "alt", and "quincunx".
|
// style = The style of subdividing the quads into faces. Valid options are "default", "alt", and "quincunx".
|
||||||
// Example(3D):
|
// Example(3D):
|
||||||
// patch = [
|
// patch = [
|
||||||
|
@ -1223,7 +1222,7 @@ function is_patch(x) =
|
||||||
// )
|
// )
|
||||||
// ];
|
// ];
|
||||||
// vnf_polyhedron(concat(edges,corners,faces));
|
// vnf_polyhedron(concat(edges,corners,faces));
|
||||||
function bezier_patch(patch, splinesteps=16, vnf=EMPTY_VNF, style="default") =
|
function bezier_patch(patch, splinesteps=16, style="default") =
|
||||||
assert(is_num(splinesteps) || is_vector(splinesteps,2))
|
assert(is_num(splinesteps) || is_vector(splinesteps,2))
|
||||||
assert(all_positive(splinesteps))
|
assert(all_positive(splinesteps))
|
||||||
is_tripatch(patch)? _bezier_triangle(patch, splinesteps=splinesteps, vnf=vnf) :
|
is_tripatch(patch)? _bezier_triangle(patch, splinesteps=splinesteps, vnf=vnf) :
|
||||||
|
@ -1238,7 +1237,7 @@ function bezier_patch(patch, splinesteps=16, vnf=EMPTY_VNF, style="default") =
|
||||||
1-step/splinesteps.y
|
1-step/splinesteps.y
|
||||||
],
|
],
|
||||||
pts = bezier_patch_points(patch, uvals, vvals),
|
pts = bezier_patch_points(patch, uvals, vvals),
|
||||||
vnf = vnf_vertex_array(pts, style=style, vnf=vnf, reverse=false)
|
vnf = vnf_vertex_array(pts, style=style, reverse=false)
|
||||||
) vnf;
|
) vnf;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1507,7 +1506,7 @@ function patch_reverse(patch) =
|
||||||
|
|
||||||
// Function: bezier_surface()
|
// Function: bezier_surface()
|
||||||
// Usage:
|
// Usage:
|
||||||
// vnf = bezier_surface(patches, [splinesteps], [vnf=], [style=]);
|
// vnf = bezier_surface(patches, [splinesteps], [style]);
|
||||||
// Topics: Bezier Patches
|
// Topics: Bezier Patches
|
||||||
// See Also: bezier_patch_points(), bezier_patch_flat()
|
// See Also: bezier_patch_points(), bezier_patch_flat()
|
||||||
// Description:
|
// Description:
|
||||||
|
@ -1520,8 +1519,6 @@ function patch_reverse(patch) =
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// patches = A list of triangular and/or rectangular bezier patches.
|
// patches = A list of triangular and/or rectangular bezier patches.
|
||||||
// splinesteps = Number of steps to divide each bezier segment into. Default: 16
|
// splinesteps = Number of steps to divide each bezier segment into. Default: 16
|
||||||
// ---
|
|
||||||
// vnf = Vertices'n'Faces [VNF structure](vnf.scad) to add new vertices and faces to. Default: empty VNF
|
|
||||||
// style = The style of subdividing the quads into faces. Valid options are "default", "alt", and "quincunx".
|
// style = The style of subdividing the quads into faces. Valid options are "default", "alt", and "quincunx".
|
||||||
// Example(3D):
|
// Example(3D):
|
||||||
// patch1 = [
|
// patch1 = [
|
||||||
|
@ -1538,13 +1535,8 @@ function patch_reverse(patch) =
|
||||||
// ];
|
// ];
|
||||||
// vnf = bezier_surface(patches=[patch1, patch2], splinesteps=16);
|
// vnf = bezier_surface(patches=[patch1, patch2], splinesteps=16);
|
||||||
// polyhedron(points=vnf[0], faces=vnf[1]);
|
// polyhedron(points=vnf[0], faces=vnf[1]);
|
||||||
function bezier_surface(patches=[], splinesteps=16, vnf=EMPTY_VNF, style="default", i=0) =
|
function bezier_surface(patches=[], splinesteps=16, style="default") =
|
||||||
let(
|
vnf_merge([for(patch=patches) bezier_patch(patch, splinesteps=splinesteps, style=style)]);
|
||||||
vnf = (i >= len(patches))? vnf :
|
|
||||||
bezier_patch(patches[i], splinesteps=splinesteps, vnf=vnf, style=style)
|
|
||||||
) (i >= len(patches))? vnf :
|
|
||||||
bezier_surface(patches=patches, splinesteps=splinesteps, vnf=vnf, style=style, i=i+1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Module: trace_bezier_patches()
|
// Module: trace_bezier_patches()
|
||||||
|
|
Loading…
Reference in a new issue