From 556747612024e2769c2e1e96e69bcf9c32191783 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 10 Feb 2020 14:25:32 +0800 Subject: [PATCH] refactor --- examples/photo_sphere.scad | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/photo_sphere.scad b/examples/photo_sphere.scad index c8f9b2d1..4b81cd8c 100644 --- a/examples/photo_sphere.scad +++ b/examples/photo_sphere.scad @@ -1,6 +1,7 @@ use ; use ; +photo_size = [100, 100]; levels = [ [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255], @@ -109,14 +110,14 @@ dots = px_gray(levels, center = true, normalize = true); color("white") for(dot = dots) { - translate(pt_to_sphere([100, 100], dot[0] + [50, 50], 50, [180, 180])) + translate(pt_to_sphere(photo_size, dot[0] + [50, 50], 50, [180, 180])) square(dot[1] * 2.5); } rotate([180, 0, 0]) color("white") for(dot = dots) { - translate(pt_to_sphere([100, 100], dot[0] + [50, 50], 50, [180, 180])) + translate(pt_to_sphere(photo_size, dot[0] + [50, 50], 50, [180, 180])) square(dot[1] * 2.5); }