From fc8433e1eae93afb4d62a42b50b4d9aa26964c6a Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 8 Jun 2017 14:54:11 +0800 Subject: [PATCH] added "HULL_LINES" option --- src/function_grapher.scad | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/function_grapher.scad b/src/function_grapher.scad index 1e6d9c90..eb273b84 100644 --- a/src/function_grapher.scad +++ b/src/function_grapher.scad @@ -22,7 +22,7 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") { rows = len(points); columns = len(points[0]); - // Increasing $fn will be slow when you use "LINES" or "HULL_FACES". + // Increasing $fn will be slow when you use "LINES", "HULL_FACES" or "HULL_LINES". module faces() { function xy_to_index(x, y, columns) = y * columns + x; @@ -161,6 +161,11 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") { polyline3d(concat(tri1, [tri1[0]]), thickness); polyline3d(concat(tri2, [tri2[0]]), thickness); } + + module tri_to_hull_lines(tri1, tri2) { + hull_polyline3d(concat(tri1, [tri1[0]]), thickness); + hull_polyline3d(concat(tri2, [tri2[0]]), thickness); + } module hull_pts(tri) { half_thickness = thickness / 2; @@ -179,15 +184,13 @@ module function_grapher(points, thickness, style = "FACES", slicing = "SLASH") { module tri_to_graph(tri1, tri2) { if(style == "LINES") { tri_to_lines(tri1, tri2); - } else { // Warning: May be very slow!! + } else if(style == "HULL_FACES") { // Warning: May be very slow!! tri_to_hull_faces(tri1, tri2); + } else if(style == "HULL_LINES") { // Warning: very very slow!! + tri_to_hull_lines(tri1, tri2); } } - - - - if(style == "FACES") { faces(); } else {