From ba5b184d16e3f9cabcb2850d54bf934195e818f5 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 30 Mar 2022 09:39:11 +0800 Subject: [PATCH] format --- docs/lib3x-along_with.md | 24 ++++++++++++------------ docs/lib3x-bend.md | 7 ++++--- docs/lib3x-circle_path.md | 6 +++--- docs/lib3x-ellipse_extrude.md | 4 +++- docs/lib3x-golden_spiral.md | 6 +++--- docs/lib3x-stereographic_extrude.md | 2 +- docs/lib3x-vx_ascii.md | 18 +++++++++--------- docs/lib3x-vx_circle.md | 4 ++-- docs/lib3x-vx_contour.md | 8 ++++---- docs/lib3x-vx_curve.md | 2 +- docs/lib3x-vx_gray.md | 6 +++--- docs/lib3x-vx_polygon.md | 8 ++++---- docs/lib3x-vx_polyline.md | 12 ++++++------ 13 files changed, 55 insertions(+), 52 deletions(-) diff --git a/docs/lib3x-along_with.md b/docs/lib3x-along_with.md index 761a924b..b62732cc 100644 --- a/docs/lib3x-along_with.md +++ b/docs/lib3x-along_with.md @@ -57,9 +57,9 @@ Puts children along the given path. If there's only one child, it will put the c angles = [for(p_a = pts_angles) p_a[1]]; along_with(points, angles) - rotate([90, 0, 0]) - linear_extrude(1, center = true) - text("A", valign = "center", halign = "center"); + rotate([90, 0, 0]) + linear_extrude(1, center = true) + text("A", valign = "center", halign = "center"); ![along_with](images/lib3x-along_with-3.JPG) @@ -69,20 +69,20 @@ Puts children along the given path. If there's only one child, it will put the c module scales() { module one_scale() { rotate([0, 60, 0]) - linear_extrude(1, center = true) - scale([2, 1]) - circle(1.25, $fn = 24); + linear_extrude(1, center = true) + scale([2, 1]) + circle(1.25, $fn = 24); } for(a = [0:30:330]) { rotate(a) - translate([5, 0, 0]) - one_scale(); - rotate(a + 15) - translate([5, 0, 1.75]) - one_scale(); - } + translate([5, 0, 0]) + one_scale(); + rotate(a + 15) + translate([5, 0, 1.75]) + one_scale(); + } } t_step = 0.01; diff --git a/docs/lib3x-bend.md b/docs/lib3x-bend.md index 8beb5288..d166a986 100644 --- a/docs/lib3x-bend.md +++ b/docs/lib3x-bend.md @@ -34,7 +34,8 @@ Once you have the size of the containing cube, you can use it as the `size` argu *cube(size = [x, y, z]); bend(size = [x, y, z], angle = 270) - linear_extrude(z) text("A"); + linear_extrude(z) + text("A"); ![bend](images/lib3x-bend-2.JPG) @@ -47,8 +48,8 @@ The arc shape is smoother if the `frags` value is larger. z = 1; bend(size = [x, y, z], angle = 270, frags = 360) - linear_extrude(z) - text("A"); + linear_extrude(z) + text("A"); ![bend](images/lib3x-bend-3.JPG) diff --git a/docs/lib3x-circle_path.md b/docs/lib3x-circle_path.md index 42e2291f..339ce4ab 100644 --- a/docs/lib3x-circle_path.md +++ b/docs/lib3x-circle_path.md @@ -21,9 +21,9 @@ Sometimes you need all points on the path of a circle. Here's the function. Its step_angle = 360 / leng; for(i = [0:leng - 1]) { translate(points[i]) - rotate([90, 0, 90 + i * step_angle]) - linear_extrude(1, center = true) - text("A", valign = "center", halign = "center"); + rotate([90, 0, 90 + i * step_angle]) + linear_extrude(1, center = true) + text("A", valign = "center", halign = "center"); } ![circle_path](images/lib3x-circle_path-1.JPG) diff --git a/docs/lib3x-ellipse_extrude.md b/docs/lib3x-ellipse_extrude.md index 631cc6ee..3074f1b4 100644 --- a/docs/lib3x-ellipse_extrude.md +++ b/docs/lib3x-ellipse_extrude.md @@ -34,7 +34,9 @@ Extrudes a 2D object along the path of an ellipse from 0 to 180 degrees. The sem ellipse_extrude(semi_minor_axis) text("♥", size = 40, valign = "center", halign = "center"); - mirror([0, 0, 1]) ellipse_extrude(semi_minor_axis) + + mirror([0, 0, 1]) + ellipse_extrude(semi_minor_axis) text("♥", size = 40, valign = "center", halign = "center"); ![ellipse_extrude](images/lib3x-ellipse_extrude-3.JPG) diff --git a/docs/lib3x-golden_spiral.md b/docs/lib3x-golden_spiral.md index bb6f1439..beef15b7 100644 --- a/docs/lib3x-golden_spiral.md +++ b/docs/lib3x-golden_spiral.md @@ -38,9 +38,9 @@ It returns a vector of `[[x, y], angle]`. for(pt_angle = pts_angles) { translate(pt_angle[0]) - rotate([90, 0, pt_angle[1]]) - linear_extrude(1, center = true) - text("A", valign = "center", halign = "center"); + rotate([90, 0, pt_angle[1]]) + linear_extrude(1, center = true) + text("A", valign = "center", halign = "center"); } ![golden_spiral](images/lib3x-golden_spiral-2.JPG) \ No newline at end of file diff --git a/docs/lib3x-stereographic_extrude.md b/docs/lib3x-stereographic_extrude.md index 2ae8b356..470c92f6 100644 --- a/docs/lib3x-stereographic_extrude.md +++ b/docs/lib3x-stereographic_extrude.md @@ -16,7 +16,7 @@ The 2D polygon should center at the origin and you have to determine the side le dimension = 100; - render() stereographic_extrude(shadow_side_leng = dimension) + stereographic_extrude(shadow_side_leng = dimension, convexity = 10) text( "M", size = dimension, valign = "center", halign = "center" diff --git a/docs/lib3x-vx_ascii.md b/docs/lib3x-vx_ascii.md index 44c1fbf5..1c885e95 100644 --- a/docs/lib3x-vx_ascii.md +++ b/docs/lib3x-vx_ascii.md @@ -16,11 +16,11 @@ Generate 8x8 voxel points of printable ASCII characters (codes 32dec to 126dec). for(i = [0:94]) { translate([8 * (i % 10), -8 * floor(i / 10), 0]) - for(p = vx_ascii(chr(i + 32))) { - translate(p) - linear_extrude(1, scale = 0.8) - square(1); - } + for(p = vx_ascii(chr(i + 32))) { + translate(p) + linear_extrude(1, scale = 0.8) + square(1); + } } ![vx_ascii](images/lib3x-vx_ascii-1.JPG) @@ -31,10 +31,10 @@ Generate 8x8 voxel points of printable ASCII characters (codes 32dec to 126dec). for(i = [0:len(t) - 1]) { translate([i * 8, 0]) - for(pt = vx_ascii(t[i], invert = true)) { - translate(pt) - sphere(0.5, $fn = 24); - } + for(pt = vx_ascii(t[i], invert = true)) { + translate(pt) + sphere(0.5, $fn = 24); + } } ![vx_ascii](images/lib3x-vx_ascii-2.JPG) \ No newline at end of file diff --git a/docs/lib3x-vx_circle.md b/docs/lib3x-vx_circle.md index 4bd48b5a..baeec752 100644 --- a/docs/lib3x-vx_circle.md +++ b/docs/lib3x-vx_circle.md @@ -24,8 +24,8 @@ Returns points that can be used to draw a voxel-style circle. for(pt = vx_circle(10, filled = true)) { translate(pt) - linear_extrude(1, scale = 0.5) - square(1, center = true); + linear_extrude(1, scale = 0.5) + square(1, center = true); } ![vx_circle](images/lib3x-vx_circle-2.JPG) diff --git a/docs/lib3x-vx_contour.md b/docs/lib3x-vx_contour.md index c6592ad6..8dbc4300 100644 --- a/docs/lib3x-vx_contour.md +++ b/docs/lib3x-vx_contour.md @@ -20,10 +20,10 @@ Given a list of points that form a closed area, `vx_contour` returns the contour linear_extrude(2) for(i = [0:len(t) - 1]) { translate([i * 8, 0]) - for(pt = vx_ascii(t[i])) { - translate(pt) - square(1, center = true); - } + for(pt = vx_ascii(t[i])) { + translate(pt) + square(1, center = true); + } } color("black") diff --git a/docs/lib3x-vx_curve.md b/docs/lib3x-vx_curve.md index ffaea666..76819499 100644 --- a/docs/lib3x-vx_curve.md +++ b/docs/lib3x-vx_curve.md @@ -25,7 +25,7 @@ Draws a voxel-by-voxel curve from control points. The curve is drawn only from t for(pt = vx_curve(pts)) { translate(pt) - cube(1); + cube(1); } #for(pt = pts) { diff --git a/docs/lib3x-vx_gray.md b/docs/lib3x-vx_gray.md index 92628428..8ed917a3 100644 --- a/docs/lib3x-vx_gray.md +++ b/docs/lib3x-vx_gray.md @@ -60,9 +60,9 @@ Given a list of numbers (0 ~ 255) that represent a gray image. This function tra g = 1 - dot[1] / 255; h = dot[1] / 85; color([g, g, g]) - translate(dot[0]) - linear_extrude(h) - square(1); + translate(dot[0]) + linear_extrude(h) + square(1); } ![vx_gray](images/lib3x-vx_gray-1.JPG) diff --git a/docs/lib3x-vx_polygon.md b/docs/lib3x-vx_polygon.md index 0018167c..8ca0588c 100644 --- a/docs/lib3x-vx_polygon.md +++ b/docs/lib3x-vx_polygon.md @@ -21,15 +21,15 @@ Returns points that can be used to draw a voxel-style polygon. for(pt = vx_polygon(pentagram)) { translate(pt) - linear_extrude(1, scale = 0.5) - square(1, center = true); + linear_extrude(1, scale = 0.5) + square(1, center = true); } translate([30, 0]) for(pt = vx_polygon(pentagram, filled = true)) { translate(pt) - linear_extrude(1, scale = 0.5) - square(1, center = true); + linear_extrude(1, scale = 0.5) + square(1, center = true); } ![vx_polygon](images/lib3x-vx_polygon-1.JPG) diff --git a/docs/lib3x-vx_polyline.md b/docs/lib3x-vx_polyline.md index 2dd0ece8..c1a28812 100644 --- a/docs/lib3x-vx_polyline.md +++ b/docs/lib3x-vx_polyline.md @@ -20,8 +20,8 @@ Given a list of points. `vx_polyline` returns points that can be used to draw a for(pt = vx_polyline([each pentagram, pentagram[0]])) { translate(pt) - linear_extrude(1, scale = 0.5) - square(1, center = true); + linear_extrude(1, scale = 0.5) + square(1, center = true); } ![vx_polyline](images/lib3x-vx_polyline-1.JPG) @@ -42,10 +42,10 @@ Given a list of points. `vx_polyline` returns points that can be used to draw a for(a = [0:30:330]) { rotate(a) - for(pt = vx_polyline(points)) { - translate(pt) - cube(1, center = true); - } + for(pt = vx_polyline(points)) { + translate(pt) + cube(1, center = true); + } } ![vx_polyline](images/lib3x-vx_polyline-2.JPG)