From 6e805163ab3866c7835179687fe65e9838de4fa4 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Wed, 14 Apr 2021 21:19:13 -0400 Subject: [PATCH] half space fixes --- mutators.scad | 36 ++++++++++++++++++------------------ vnf.scad | 6 +++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/mutators.scad b/mutators.scad index a763e6d..133dab5 100644 --- a/mutators.scad +++ b/mutators.scad @@ -147,8 +147,8 @@ module half_of(v=UP, cp, s=1000, planar=false) } } -function half_of(_arg1=_undef, _arg2=_undef, _arg3=_undef, _arg4=_undef, - v=_undef, cp=_undef, p=_undef, s=_undef) = +function half_of(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, _arg4=_UNDEF, + v=_UNDEF, cp=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3, _arg4], [[v,undef,0], [cp,0,2], [p,undef,1], [s, 1e4]]), v=args[0], cp0=args[1], p=args[2], s=args[3], @@ -223,12 +223,12 @@ module left_half(s=1000, x=0, planar=false) } } } -function left_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function left_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) - half_of(v=[1,0,0], cp=x, p=p); + half_of(v=[-1,0,0], cp=x, p=p); @@ -265,12 +265,12 @@ module right_half(s=1000, x=0, planar=false) } } } -function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function right_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) - half_of(v=[-1,0,0], cp=x, p=p); + half_of(v=[1,0,0], cp=x, p=p); @@ -307,12 +307,12 @@ module front_half(s=1000, y=0, planar=false) } } } -function front_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function front_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) - half_of(v=[0,1,0], cp=x, p=p); + half_of(v=[0,-1,0], cp=x, p=p); @@ -349,12 +349,12 @@ module back_half(s=1000, y=0, planar=false) } } } -function back_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function back_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) - half_of(v=[0,-1,0], cp=x, p=p); + half_of(v=[0,1,0], cp=x, p=p); @@ -383,8 +383,8 @@ module bottom_half(s=1000, z=0) } } } -function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function bottom_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) @@ -417,8 +417,8 @@ module top_half(s=1000, z=0) } } } -function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef, - x=_undef, p=_undef, s=_undef) = +function top_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, + x=_UNDEF, p=_UNDEF, s=_UNDEF) = let(args=get_named_args([_arg1, _arg2, _arg3], [[x, 0,1], [p,undef,0], [s, 1e4]]), x=args[0], p=args[1], s=args[2]) diff --git a/vnf.scad b/vnf.scad index 48806c7..bcb16d5 100644 --- a/vnf.scad +++ b/vnf.scad @@ -1146,8 +1146,8 @@ function _vnf_halfspace_paths(edges, i=0, paths=[]) = s[0] != s[1] ? [concat(paths[s[0]], paths[s[1]])] : // edge closes a loop [concat(paths[s[0]], [e[1]])])); -function vnf_halfspace(_arg1=_undef, _arg2=_undef, - halfspace=_undef, vnf=_undef) = +function vnf_halfspace(_arg1=_UNDEF, _arg2=_UNDEF, + halfspace=_UNDEF, vnf=_UNDEF) = // here is where we wish that OpenSCAD had array lvalues... let(args=get_named_args([_arg1, _arg2], [[halfspace],[vnf]]), halfspace=args[0], vnf=args[1]) @@ -1163,7 +1163,7 @@ function vnf_halfspace(_arg1=_undef, _arg2=_undef, newedges=[for(x=tmp2) each x[1]], // generate new faces paths=_vnf_halfspace_paths(newedges), - loops=[for(p=paths) if(p[0] == last(p)) p]) + loops=[for(p=paths) if(coords[p[0]] == coords[last(p)]) reverse(p)]) [coords, concat(newfaces, loops)]; // vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap