From a8db3919c1f40bfec9169ad7aed4024cd45b0e34 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Tue, 12 Nov 2019 13:55:12 -0800 Subject: [PATCH] Added more edge set figures. --- edges.scad | 167 +++++++++++++++++++++++++-------------------------- version.scad | 2 +- 2 files changed, 84 insertions(+), 85 deletions(-) diff --git a/edges.scad b/edges.scad index 554ad03..6ac3d37 100644 --- a/edges.scad +++ b/edges.scad @@ -8,6 +8,33 @@ ////////////////////////////////////////////////////////////////////// +// CommonCode: +// module text3d(txt,size=3) { +// if (is_list(txt)) { +// for (i=idx(txt)) { +// down((i-len(txt)/2+1)*size*1.25) { +// text3d(txt[i], size=size); +// } +// } +// } else { +// xrot(90) color("#000") +// linear_extrude(height=0.1) { +// text(text=txt, size=size, halign="center", valign="center"); +// } +// } +// } +// module edge_cube(size=20, chamfer=3, txtsize=3, edges="ALL") { +// lbl = is_string(edges)? [str("\"",edges,"\"")] : concat( +// edges.z>0? ["TOP"] : edges.z<0? ["BTM"] : [], +// edges.y>0? ["BACK"] : edges.y<0? ["FWD"] : [], +// edges.x>0? ["RIGHT"] : edges.x<0? ["LEFT"] : [] +// ); +// lbl2 = [for (i=idx(lbl)) i0? 1 : 0]]; // [X-Y-, X+Y-, X-Y+, X+Y+] // ] // ``` -// Figure(3DBig): Face Vector Edge Sets -// module text3d(txt) { -// xrot(90) -// color("#000") -// linear_extrude(height=0.1) { -// text(text=txt, size=3, halign="center", valign="center"); -// } -// } +// Figure(3DBig): Edge Vectors // ydistribute(50) { -// ydistribute(10) { -// xdistribute(30) { -// text3d("LEFT"); -// text3d("FRONT"); -// text3d("RIGHT"); -// } -// xdistribute(30) { -// cuboid(20,chamfer=3,edges=LEFT); -// cuboid(20,chamfer=3,edges=FRONT); -// cuboid(20,chamfer=3,edges=RIGHT); -// } +// xdistribute(30) { +// edge_cube(edges=BOT+RIGHT); +// edge_cube(edges=BOT+BACK); +// edge_cube(edges=BOT+LEFT); +// edge_cube(edges=BOT+FRONT); // } -// ydistribute(10) { -// xdistribute(30) { -// text3d("TOP"); -// text3d("BACK"); -// text3d("BOTTOM"); -// } -// xdistribute(30) { -// cuboid(20,chamfer=3,edges=TOP); -// cuboid(20,chamfer=3,edges=BACK); -// cuboid(20,chamfer=3,edges=BOTTOM); -// } +// xdistribute(30) { +// edge_cube(edges=FWD+RIGHT); +// edge_cube(edges=BACK+RIGHT); +// edge_cube(edges=BACK+LEFT); +// edge_cube(edges=FWD+LEFT); +// } +// xdistribute(30) { +// edge_cube(edges=TOP+RIGHT); +// edge_cube(edges=TOP+BACK); +// edge_cube(edges=TOP+LEFT); +// edge_cube(edges=TOP+FRONT); // } // } -// Figure(3DBig): Named Edge Sets -// module text3d(txt) { -// xrot(90) -// color("#000") -// linear_extrude(height=0.1) { -// text(text=txt, size=3.5, halign="center", valign="center"); +// Figure(3DBig): Corner Vector Edge Sets +// ydistribute(50) { +// xdistribute(30) { +// edge_cube(edges=FRONT+LEFT+TOP); +// edge_cube(edges=FRONT+RIGHT+TOP); +// edge_cube(edges=FRONT+LEFT+BOT); +// edge_cube(edges=FRONT+RIGHT+BOT); +// } +// xdistribute(30) { +// edge_cube(edges=TOP+LEFT+BACK); +// edge_cube(edges=TOP+RIGHT+BACK); +// edge_cube(edges=BOT+LEFT+BACK); +// edge_cube(edges=BOT+RIGHT+BACK); // } // } -// ydistribute(75) { -// ydistribute(10) { -// xdistribute(30) { -// text3d("\"X\""); -// text3d("\"Y\""); -// text3d("\"Z\""); -// } -// xdistribute(30) { -// cuboid(20,chamfer=3,edges="X"); -// cuboid(20,chamfer=3,edges="Y"); -// cuboid(20,chamfer=3,edges="Z"); -// } +// Figure(3D): Face Vector Edge Sets +// ydistribute(50) { +// xdistribute(30) { +// edge_cube(edges=LEFT); +// edge_cube(edges=FRONT); +// edge_cube(edges=RIGHT); // } -// ydistribute(10) { -// xdistribute(30) { -// text3d("\"ALL\""); -// text3d("\"NONE\""); -// } -// xdistribute(30) { -// cuboid(20,chamfer=3,edges="ALL"); -// cuboid(20,chamfer=3,edges="NONE"); -// } +// xdistribute(30) { +// edge_cube(edges=TOP); +// edge_cube(edges=BACK); +// edge_cube(edges=BOTTOM); +// } +// } +// Figure(3D): Named Edge Sets +// ydistribute(50) { +// xdistribute(30) { +// edge_cube(edges="X"); +// edge_cube(edges="Y"); +// edge_cube(edges="Z"); +// } +// xdistribute(30) { +// edge_cube(edges="ALL"); +// edge_cube(edges="NONE"); // } // } // Example: Just the front-top edge @@ -199,10 +198,10 @@ function normalize_edges(v) = [for (ax=v) [for (edge=ax) edge>0? 1 : 0]]; function edges(v, except=[]) = (is_string(v) || is_vector(v) || is_edge_array(v))? edges([v], except=except) : (is_string(except) || is_vector(except) || is_edge_array(except))? edges(v, except=[except]) : - except==[]? normalize_edges(sum([for (x=v) edge_set(x)])) : + except==[]? normalize_edges(sum([for (x=v) _edge_set(x)])) : normalize_edges( - normalize_edges(sum([for (x=v) edge_set(x)])) - - sum([for (x=except) edge_set(x)]) + normalize_edges(sum([for (x=v) _edge_set(x)])) - + sum([for (x=except) _edge_set(x)]) ); diff --git a/version.scad b/version.scad index 35b6dd8..8fb753b 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,33]; +BOSL_VERSION = [2,0,34]; // Section: BOSL Library Version Functions