mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
more beziers fixes
This commit is contained in:
parent
80c6e0666d
commit
a7ca1b1b64
1 changed files with 13 additions and 11 deletions
24
beziers.scad
24
beziers.scad
|
@ -1157,7 +1157,7 @@ function is_patch(x) =
|
||||||
// ];
|
// ];
|
||||||
// vnf = bezier_patch(tri, splinesteps=16);
|
// vnf = bezier_patch(tri, splinesteps=16);
|
||||||
// vnf_polyhedron(vnf);
|
// vnf_polyhedron(vnf);
|
||||||
// Example(3D,FlatSpin,VPD=444): Chaining Patches
|
// Example(3D,FlatSpin,VPD=444): Merging multiple patches
|
||||||
// patch = [
|
// patch = [
|
||||||
// // u=0,v=0 u=1,v=0
|
// // u=0,v=0 u=1,v=0
|
||||||
// [[0, 0,0], [33, 0, 0], [67, 0, 0], [100, 0,0]],
|
// [[0, 0,0], [33, 0, 0], [67, 0, 0], [100, 0,0]],
|
||||||
|
@ -1166,13 +1166,15 @@ function is_patch(x) =
|
||||||
// [[0,100,0], [33,100, 0], [67,100, 0], [100,100,0]],
|
// [[0,100,0], [33,100, 0], [67,100, 0], [100,100,0]],
|
||||||
// // u=0,v=1 u=1,v=1
|
// // u=0,v=1 u=1,v=1
|
||||||
// ];
|
// ];
|
||||||
// vnf1 = bezier_patch(translate(p=patch,[-50,-50,50]));
|
// tpatch = translate([-50,-50,50], patch);
|
||||||
// vnf2 = bezier_patch(vnf=vnf1, rot(a=[90,0,0],p=translate(p=patch,[-50,-50,50])));
|
// vnf = vnf_merge([
|
||||||
// vnf3 = bezier_patch(vnf=vnf2, rot(a=[-90,0,0],p=translate(p=patch,[-50,-50,50])));
|
// bezier_patch(tpatch),
|
||||||
// vnf4 = bezier_patch(vnf=vnf3, rot(a=[180,0,0],p=translate(p=patch,[-50,-50,50])));
|
// bezier_patch(xrot(90, tpatch)),
|
||||||
// vnf5 = bezier_patch(vnf=vnf4, rot(a=[0,90,0],p=translate(p=patch,[-50,-50,50])));
|
// bezier_patch(xrot(-90, tpatch)),
|
||||||
// vnf6 = bezier_patch(vnf=vnf5, rot(a=[0,-90,0],p=translate(p=patch,[-50,-50,50])));
|
// bezier_patch(xrot(180, tpatch)),
|
||||||
// vnf_polyhedron(vnf6);
|
// bezier_patch(yrot(90, tpatch)),
|
||||||
|
// bezier_patch(yrot(-90, tpatch))]);
|
||||||
|
// vnf_polyhedron(vnf);
|
||||||
// Example(3D): Connecting Patches with Asymmetric Splinesteps
|
// Example(3D): Connecting Patches with Asymmetric Splinesteps
|
||||||
// steps = 8;
|
// steps = 8;
|
||||||
// edge_patch = [
|
// edge_patch = [
|
||||||
|
@ -1225,7 +1227,7 @@ function is_patch(x) =
|
||||||
function bezier_patch(patch, splinesteps=16, 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) :
|
||||||
let(
|
let(
|
||||||
splinesteps = is_list(splinesteps) ? splinesteps : [splinesteps,splinesteps],
|
splinesteps = is_list(splinesteps) ? splinesteps : [splinesteps,splinesteps],
|
||||||
uvals = [
|
uvals = [
|
||||||
|
@ -1430,7 +1432,7 @@ function bezier_patch_degenerate(patch, splinesteps=16, reverse=false, return_ed
|
||||||
function _tri_count(n) = (n*(1+n))/2;
|
function _tri_count(n) = (n*(1+n))/2;
|
||||||
|
|
||||||
|
|
||||||
function _bezier_triangle(tri, splinesteps=16, vnf=EMPTY_VNF) =
|
function _bezier_triangle(tri, splinesteps=16) =
|
||||||
assert(is_num(splinesteps))
|
assert(is_num(splinesteps))
|
||||||
let(
|
let(
|
||||||
pts = [
|
pts = [
|
||||||
|
@ -1455,7 +1457,7 @@ function _bezier_triangle(tri, splinesteps=16, vnf=EMPTY_VNF) =
|
||||||
)
|
)
|
||||||
) for (face=allfaces) face
|
) for (face=allfaces) face
|
||||||
]
|
]
|
||||||
) vnf_merge([vnf,[pts, faces]]);
|
) [pts, faces];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue