From 57d906bb85d512441bebec3a27dae2254ccea43c Mon Sep 17 00:00:00 2001 From: Garth Minette <revarbat@gmail.com> Date: Fri, 30 Jul 2021 13:40:12 -0700 Subject: [PATCH] Tweak color cubes in Mutators tutorial. --- tutorials/Mutators.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tutorials/Mutators.md b/tutorials/Mutators.md index 299fc1e..276b62a 100644 --- a/tutorials/Mutators.md +++ b/tutorials/Mutators.md @@ -253,9 +253,11 @@ easier to select colors using other color schemes. You can use the HSL or Hue-S color scheme with the `HSL()` module: ```openscad -for (h=[0:0.1:1], s=[0:0.1:1], l=[0:0.1:1]) { - translate(100*[h,s,l]) { - HSL(h*360,1-s,l) cube(10,center=true); +n = 10; size = 100/n; +for (a=count(n), b=count(n), c=count(n)) { + let( h=360*a/n, s=1-b/(n-1), l=c/(n-1)) + translate(size*[a,b,c]) { + HSL(h,s,l) cube(size); } } ``` @@ -263,9 +265,11 @@ for (h=[0:0.1:1], s=[0:0.1:1], l=[0:0.1:1]) { You can use the HSV or Hue-Saturation-Value color scheme with the `HSV()` module: ```openscad -for (h=[0:0.1:1], s=[0:0.1:1], v=[0:0.1:1]) { - translate(100*[h,s,v]) { - HSV(h*360,1-s,v) cube(10,center=true); +n = 10; size = 100/n; +for (a=count(n), b=count(n), c=count(n)) { + let( h=360*a/n, s=1-b/(n-1), v=c/(n-1)) + translate(size*[a,b,c]) { + HSV(h,s,v) cube(size); } } ```