From 17d8aa9a7e1321d0b1702354d4872011b49efcff Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 23 May 2020 16:57:12 +0800 Subject: [PATCH] voronoi preview --- examples/taiwan/dancing_taiwan.scad | 6 +- examples/voronoi/voronoi_bracelet.scad | 4 +- examples/voronoi/voronoi_fibonacci.scad | 4 +- examples/voronoi/voronoi_penholder.scad | 4 +- examples/voronoi/voronoi_torus.scad | 4 +- examples/voronoi/voronoi_vase.scad | 12 ++-- .../_impl/_convex_intersection_impl.scad | 4 +- ...i_cells_demo.scad => vrn2_cells_from.scad} | 4 +- ...s_demo.scad => vrn2_space_cells_demo.scad} | 4 +- src/experimental/note.md | 5 +- src/voronoi/_impl/_convex_center_p.scad | 3 + src/voronoi/_impl/_convex_ct_clk_order.scad | 10 ++++ src/voronoi/_impl/_convex_intersection.scad | 29 ++++++++++ .../_impl/_convex_intersection_for.scad | 18 ++++++ .../_impl/_vrn2_cells_from_impl.scad} | 2 +- .../_impl/_vrn2_space_cells_impl.scad} | 0 .../vrn2_cells_from.scad} | 10 ++-- src/voronoi/vrn2_from.scad | 55 +++++++++++++++++++ .../vrn2_space.scad} | 2 +- .../vrn2_space_cells.scad} | 10 ++-- src/voronoi/vrn3_from.scad | 43 +++++++++++++++ .../vrn3_space.scad} | 2 +- 22 files changed, 198 insertions(+), 37 deletions(-) rename src/experimental/demo/{voronoi_cells_demo.scad => vrn2_cells_from.scad} (86%) rename src/experimental/demo/{voronoi_square_cells_demo.scad => vrn2_space_cells_demo.scad} (80%) create mode 100644 src/voronoi/_impl/_convex_center_p.scad create mode 100644 src/voronoi/_impl/_convex_ct_clk_order.scad create mode 100644 src/voronoi/_impl/_convex_intersection.scad create mode 100644 src/voronoi/_impl/_convex_intersection_for.scad rename src/{experimental/_impl/_voronoi2d_cells_impl.scad => voronoi/_impl/_vrn2_cells_from_impl.scad} (95%) rename src/{experimental/_impl/_voronoi_square_cells_impl.scad => voronoi/_impl/_vrn2_space_cells_impl.scad} (100%) rename src/{experimental/voronoi_cells.scad => voronoi/vrn2_cells_from.scad} (61%) create mode 100644 src/voronoi/vrn2_from.scad rename src/{experimental/voronoi_square.scad => voronoi/vrn2_space.scad} (97%) rename src/{experimental/voronoi_square_cells.scad => voronoi/vrn2_space_cells.scad} (81%) create mode 100644 src/voronoi/vrn3_from.scad rename src/{experimental/voronoi_cube.scad => voronoi/vrn3_space.scad} (98%) diff --git a/examples/taiwan/dancing_taiwan.scad b/examples/taiwan/dancing_taiwan.scad index 241faf8d..61320cfc 100644 --- a/examples/taiwan/dancing_taiwan.scad +++ b/examples/taiwan/dancing_taiwan.scad @@ -2,7 +2,7 @@ use ; use ; use ; use ; -use ; +use ; use ; use ; @@ -54,8 +54,8 @@ module dancing_formosan(x1, x2, x3, y1, y2, y3, twist, t_step) { sections2 = cal_sections(taiwan2, edge_path2, twist); difference() { - polysections(sections); - polysections(sections2); + sweep(sections); + sweep(sections2); } translate([0, 0, -2]) diff --git a/examples/voronoi/voronoi_bracelet.scad b/examples/voronoi/voronoi_bracelet.scad index 8cd4df41..99744169 100644 --- a/examples/voronoi/voronoi_bracelet.scad +++ b/examples/voronoi/voronoi_bracelet.scad @@ -1,5 +1,5 @@ use ; -use ; +use ; use ; r = 35; @@ -30,7 +30,7 @@ module voronoi_bracelet(r, height, thickness, n, frags, offset_r, region_type) { { difference() { square([x, y]); - voronoi2d(points, spacing = thickness, r = offset_r, region_type = region_type); + vrn2_from(points, spacing = thickness, r = offset_r, region_type = region_type); } hollow_out(thickness * 1.5) square([x, y]); diff --git a/examples/voronoi/voronoi_fibonacci.scad b/examples/voronoi/voronoi_fibonacci.scad index 343268f7..549d3075 100644 --- a/examples/voronoi/voronoi_fibonacci.scad +++ b/examples/voronoi/voronoi_fibonacci.scad @@ -1,7 +1,7 @@ use ; use ; use ; -use ; +use ; spirals = 2; // [2:] line_thickness = .5; @@ -33,7 +33,7 @@ module voronoi_fibonacci() { half_line_thicness = line_thickness / 2; lst_r = norm(spiral[len(spiral) - 1]) + half_line_thicness; - cells = voronoi2d_cells(pts); + cells = vrn2_cells_from(pts); for(i = [0:len(pts) - 1]) { cell = cells[i]; diff --git a/examples/voronoi/voronoi_penholder.scad b/examples/voronoi/voronoi_penholder.scad index 26698c8e..e2a30a56 100644 --- a/examples/voronoi/voronoi_penholder.scad +++ b/examples/voronoi/voronoi_penholder.scad @@ -1,4 +1,4 @@ -use ; +use ; use ; use ; @@ -11,7 +11,7 @@ $fn = 24; color("black") bend_extrude(size, thickness = thickness, angle = 360) - voronoi_square(size, grid_w, seed, spacing); + vrn2_space(size, grid_w, seed, spacing); r = size[0] / (2 * PI); linear_extrude(size[1]) diff --git a/examples/voronoi/voronoi_torus.scad b/examples/voronoi/voronoi_torus.scad index 7da18956..441aba34 100644 --- a/examples/voronoi/voronoi_torus.scad +++ b/examples/voronoi/voronoi_torus.scad @@ -1,10 +1,10 @@ -use ; +use ; use ; use ; size = [40, 80]; grid_w = 5; -cells = voronoi_square_cells(size, grid_w); +cells = vrn2_space_cells(size, grid_w); $fn = 4; diff --git a/examples/voronoi/voronoi_vase.scad b/examples/voronoi/voronoi_vase.scad index 6e7728ab..712658a9 100644 --- a/examples/voronoi/voronoi_vase.scad +++ b/examples/voronoi/voronoi_vase.scad @@ -1,7 +1,7 @@ -use ; +use ; use ; use ; -use ; +use ; r = 13; h = 60; @@ -44,13 +44,13 @@ module voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step) { difference() { scale([0.95, 0.95, 1]) - polysections(sections); + sweep(sections); scale([0.85, 0.85, 1]) - polysections(sections); + sweep(sections); intersection() { - polysections(sections); + sweep(sections); render() - voronoi3d(concat([for(i = indices) pts[i]], [sections[0][0], sections[0][half_fn], sections[last_section_i][0], sections[last_section_i][half_fn]])); + vrn3_from(concat([for(i = indices) pts[i]], [sections[0][0], sections[0][half_fn], sections[last_section_i][0], sections[last_section_i][half_fn]])); } } diff --git a/src/experimental/_impl/_convex_intersection_impl.scad b/src/experimental/_impl/_convex_intersection_impl.scad index 4c04fcc0..3b6aa56f 100644 --- a/src/experimental/_impl/_convex_intersection_impl.scad +++ b/src/experimental/_impl/_convex_intersection_impl.scad @@ -1,4 +1,4 @@ -use ; +use ; function _intersection_ps(shape, line_pts, epsilon) = let( @@ -7,6 +7,6 @@ function _intersection_ps(shape, line_pts, epsilon) = ) [ for(i = [0:leng - 1]) - let(p = intersection_p(line_pts, [pts[i], pts[i + 1]], epsilon = epsilon)) + let(p = lines_intersection(line_pts, [pts[i], pts[i + 1]], epsilon = epsilon)) if(p != []) p ]; \ No newline at end of file diff --git a/src/experimental/demo/voronoi_cells_demo.scad b/src/experimental/demo/vrn2_cells_from.scad similarity index 86% rename from src/experimental/demo/voronoi_cells_demo.scad rename to src/experimental/demo/vrn2_cells_from.scad index ed6c0f9a..190471c6 100644 --- a/src/experimental/demo/voronoi_cells_demo.scad +++ b/src/experimental/demo/vrn2_cells_from.scad @@ -1,12 +1,12 @@ use ; use ; -use ; +use ; xs1 = rands(-20, 20, 15); ys1 = rands(-20, 20, 15); points = [for(i = [0:len(xs1) - 1]) [xs1[i], ys1[i]]]; -cells = voronoi_cells(points); +cells = vrn2_cells_from(points); for(i = [0:len(points) - 1]) { pt = points[i]; cell = cells[i]; diff --git a/src/experimental/demo/voronoi_square_cells_demo.scad b/src/experimental/demo/vrn2_space_cells_demo.scad similarity index 80% rename from src/experimental/demo/voronoi_square_cells_demo.scad rename to src/experimental/demo/vrn2_space_cells_demo.scad index 57db6d10..3b99aa78 100644 --- a/src/experimental/demo/voronoi_square_cells_demo.scad +++ b/src/experimental/demo/vrn2_space_cells_demo.scad @@ -1,9 +1,9 @@ use ; -use ; +use ; size = [20, 20]; grid_w = 5; -cells = voronoi_square_cells(size, grid_w); +cells = vrn2_space_cells(size, grid_w); for(cell = cells) { cell_pt = cell[0]; diff --git a/src/experimental/note.md b/src/experimental/note.md index 2cf3e3b1..97b36f9e 100644 --- a/src/experimental/note.md +++ b/src/experimental/note.md @@ -1,13 +1,16 @@ to_do: - deprecate `trianglate`, use `tri_ear_clipping`. -- deprecate `pixel` + +- deprecate `pixel...` +- deprecate `voronoi2d`, `voronoi3d` improved: - polyline2d: improved middle-point drawing, support joinStyle 2.4 preview: +- voronoi/... - voxel/.... - lines_intersection2 - util/sum diff --git a/src/voronoi/_impl/_convex_center_p.scad b/src/voronoi/_impl/_convex_center_p.scad new file mode 100644 index 00000000..62c7c3a2 --- /dev/null +++ b/src/voronoi/_impl/_convex_center_p.scad @@ -0,0 +1,3 @@ +use <../../util/sum.scad>; + +function _convex_center_p(points) = sum(points) / len(points); \ No newline at end of file diff --git a/src/voronoi/_impl/_convex_ct_clk_order.scad b/src/voronoi/_impl/_convex_ct_clk_order.scad new file mode 100644 index 00000000..481a6c9a --- /dev/null +++ b/src/voronoi/_impl/_convex_ct_clk_order.scad @@ -0,0 +1,10 @@ +use <../../util/sort.scad>; +use <_convex_center_p.scad>; + +function _convex_ct_clk_order(points) = + let( + cpt = _convex_center_p(points), + pts_as = [for(p = points) [p, atan2(p[1] - cpt[1], p[0] - cpt[0])]], + sorted = sort(pts_as, by = "idx", idx = 1) + ) + [for(v = sorted) v[0]]; \ No newline at end of file diff --git a/src/voronoi/_impl/_convex_intersection.scad b/src/voronoi/_impl/_convex_intersection.scad new file mode 100644 index 00000000..9051a5b8 --- /dev/null +++ b/src/voronoi/_impl/_convex_intersection.scad @@ -0,0 +1,29 @@ + +use <../../in_shape.scad>; +use <../../lines_intersection.scad>; +use <_convex_ct_clk_order.scad>; + +function _intersection_ps(shape, line_pts, epsilon) = + let( + leng = len(shape), + pts = concat(shape, [shape[0]]) + ) + [ + for(i = [0:leng - 1]) + let(p = lines_intersection(line_pts, [pts[i], pts[i + 1]], epsilon = epsilon)) + if(p != []) p + ]; + +function _convex_intersection(shape1, shape2, epsilon = 0.0001) = + (shape1 == [] || shape2 == []) ? [] : + let( + leng = len(shape1), + pts = concat(shape1, [shape1[0]]) + ) + _convex_ct_clk_order( + concat( + [for(p = shape1) if(in_shape(shape2, p, include_edge = true)) p], + [for(p = shape2) if(in_shape(shape1, p, include_edge = true)) p], + [for(i = [0:leng - 1]) each _intersection_ps(shape2, [pts[i], pts[i + 1]], epsilon)] + ) + ); \ No newline at end of file diff --git a/src/voronoi/_impl/_convex_intersection_for.scad b/src/voronoi/_impl/_convex_intersection_for.scad new file mode 100644 index 00000000..7d3fbd39 --- /dev/null +++ b/src/voronoi/_impl/_convex_intersection_for.scad @@ -0,0 +1,18 @@ +use <_convex_intersection.scad>; + +function _convex_intersection_for_impl(shapes, pre, leng, i = 2) = + i == leng ? pre : + let(r = _convex_intersection(pre, shapes[i])) + r == [] ? [] + : _convex_intersection_for_impl(shapes, + r, + leng, i + 1 + ); + +function _convex_intersection_for(shapes) = + let(leng = len(shapes)) + _convex_intersection_for_impl( + shapes, + _convex_intersection(shapes[0], shapes[1]), + leng + ); \ No newline at end of file diff --git a/src/experimental/_impl/_voronoi2d_cells_impl.scad b/src/voronoi/_impl/_vrn2_cells_from_impl.scad similarity index 95% rename from src/experimental/_impl/_voronoi2d_cells_impl.scad rename to src/voronoi/_impl/_vrn2_cells_from_impl.scad index f5f504ad..4fba8009 100644 --- a/src/experimental/_impl/_voronoi2d_cells_impl.scad +++ b/src/voronoi/_impl/_vrn2_cells_from_impl.scad @@ -1,4 +1,4 @@ -use ; +use <../../ptf/ptf_rotate.scad>; function _default_region_size(points) = let( diff --git a/src/experimental/_impl/_voronoi_square_cells_impl.scad b/src/voronoi/_impl/_vrn2_space_cells_impl.scad similarity index 100% rename from src/experimental/_impl/_voronoi_square_cells_impl.scad rename to src/voronoi/_impl/_vrn2_space_cells_impl.scad diff --git a/src/experimental/voronoi_cells.scad b/src/voronoi/vrn2_cells_from.scad similarity index 61% rename from src/experimental/voronoi_cells.scad rename to src/voronoi/vrn2_cells_from.scad index cd3ea876..144c6615 100644 --- a/src/experimental/voronoi_cells.scad +++ b/src/voronoi/vrn2_cells_from.scad @@ -1,8 +1,8 @@ -use ; -use ; -use ; +use <_impl/_vrn2_cells_from_impl.scad>; +use <_impl/_convex_intersection_for.scad>; +use <../shape_square.scad>; -function voronoi_cells(points) = +function vrn2_cells_from(points) = let( size = _default_region_size(points), half_size = size * 0.5, @@ -14,5 +14,5 @@ function voronoi_cells(points) = ) [ for(regions = regions_lt) - convex_intersection_for(regions) + _convex_intersection_for(regions) ]; \ No newline at end of file diff --git a/src/voronoi/vrn2_from.scad b/src/voronoi/vrn2_from.scad new file mode 100644 index 00000000..9381f8fa --- /dev/null +++ b/src/voronoi/vrn2_from.scad @@ -0,0 +1,55 @@ +/** +* vrn2_from.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn2_from.html +* +**/ + +module vrn2_from(points, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") { + xs = [for(p = points) p[0]]; + ys = [for(p = points) abs(p[1])]; + + region_size = max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]); + half_region_size = 0.5 * region_size; + offset_leng = spacing * 0.5 + half_region_size; + + function normalize(v) = v / norm(v); + + module region(pt) { + intersection_for(p = points) { + if(pt != p) { + v = p - pt; + translate((pt + p) / 2 - normalize(v) * offset_leng) + rotate(atan2(v[1], v[0])) + children(); + } + } + } + + module offseted_region(pt) { + if(r != 0) { + offset(r) + region(pt) + children(); + } + else { + offset(delta = delta, chamfer = chamfer) + region(pt) + children(); + } + } + + for(p = points) { + if(region_type == "square") { + offseted_region(p) + square(region_size, center = true); + } + else { + offseted_region(p) + circle(half_region_size); + } + } +} \ No newline at end of file diff --git a/src/experimental/voronoi_square.scad b/src/voronoi/vrn2_space.scad similarity index 97% rename from src/experimental/voronoi_square.scad rename to src/voronoi/vrn2_space.scad index b393f9ec..319202ac 100644 --- a/src/experimental/voronoi_square.scad +++ b/src/voronoi/vrn2_space.scad @@ -1,4 +1,4 @@ -module voronoi_square(size, grid_w, seed, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") { +module vrn2_space(size, grid_w, seed, spacing = 1, r = 0, delta = 0, chamfer = false, region_type = "square") { _noise_table = [0.592157, 0.627451, 0.537255, 0.356863, 0.352941, 0.0588235, 0.513725, 0.0509804, 0.788235, 0.372549, 0.376471, 0.207843, 0.760784, 0.913725, 0.027451, 0.882353, 0.54902, 0.141176, 0.403922, 0.117647, 0.270588, 0.556863, 0.0313725, 0.388235, 0.145098, 0.941176, 0.0823529, 0.0392157, 0.0901961, 0.745098, 0.0235294, 0.580392, 0.968627, 0.470588, 0.917647, 0.294118, 0, 0.101961, 0.772549, 0.243137, 0.368627, 0.988235, 0.858824, 0.796078, 0.458824, 0.137255, 0.0431373, 0.12549, 0.223529, 0.694118, 0.129412, 0.345098, 0.929412, 0.584314, 0.219608, 0.341176, 0.682353, 0.0784314, 0.490196, 0.533333, 0.670588, 0.658824, 0.266667, 0.686275, 0.290196, 0.647059, 0.278431, 0.52549, 0.545098, 0.188235, 0.105882, 0.65098, 0.301961, 0.572549, 0.619608, 0.905882, 0.32549, 0.435294, 0.898039, 0.478431, 0.235294, 0.827451, 0.521569, 0.901961, 0.862745, 0.411765, 0.360784, 0.160784, 0.215686, 0.180392, 0.960784, 0.156863, 0.956863, 0.4, 0.560784, 0.211765, 0.254902, 0.0980392, 0.247059, 0.631373, 0.00392157, 0.847059, 0.313725, 0.286275, 0.819608, 0.298039, 0.517647, 0.733333, 0.815686, 0.34902, 0.0705882, 0.662745, 0.784314, 0.768627, 0.529412, 0.509804, 0.454902, 0.737255, 0.623529, 0.337255, 0.643137, 0.392157, 0.427451, 0.776471, 0.678431, 0.729412, 0.0117647, 0.25098, 0.203922, 0.85098, 0.886275, 0.980392, 0.486275, 0.482353, 0.0196078, 0.792157, 0.14902, 0.576471, 0.462745, 0.494118, 1, 0.321569, 0.333333, 0.831373, 0.811765, 0.807843, 0.231373, 0.890196, 0.184314, 0.0627451, 0.227451, 0.0666667, 0.713725, 0.741176, 0.109804, 0.164706, 0.87451, 0.717647, 0.666667, 0.835294, 0.466667, 0.972549, 0.596078, 0.00784314, 0.172549, 0.603922, 0.639216, 0.27451, 0.866667, 0.6, 0.396078, 0.607843, 0.654902, 0.168627, 0.67451, 0.0352941, 0.505882, 0.0862745, 0.152941, 0.992157, 0.0745098, 0.384314, 0.423529, 0.431373, 0.309804, 0.443137, 0.878431, 0.909804, 0.698039, 0.72549, 0.439216, 0.407843, 0.854902, 0.964706, 0.380392, 0.894118, 0.984314, 0.133333, 0.94902, 0.756863, 0.933333, 0.823529, 0.564706, 0.0470588, 0.74902, 0.701961, 0.635294, 0.945098, 0.317647, 0.2, 0.568627, 0.921569, 0.976471, 0.054902, 0.937255, 0.419608, 0.192157, 0.752941, 0.839216, 0.121569, 0.709804, 0.780392, 0.415686, 0.615686, 0.721569, 0.329412, 0.8, 0.690196, 0.45098, 0.47451, 0.196078, 0.176471, 0.498039, 0.0156863, 0.588235, 0.996078, 0.541176, 0.92549, 0.803922, 0.364706, 0.870588, 0.447059, 0.262745, 0.113725, 0.0941176, 0.282353, 0.952941, 0.552941, 0.501961, 0.764706, 0.305882, 0.258824, 0.843137, 0.239216, 0.611765, 0.705882]; function _lookup_noise_table(i) = _noise_table[i % 256]; diff --git a/src/experimental/voronoi_square_cells.scad b/src/voronoi/vrn2_space_cells.scad similarity index 81% rename from src/experimental/voronoi_square_cells.scad rename to src/voronoi/vrn2_space_cells.scad index 6e1cd5a5..563306fb 100644 --- a/src/experimental/voronoi_square_cells.scad +++ b/src/voronoi/vrn2_space_cells.scad @@ -1,8 +1,8 @@ -use ; -use ; -use ; +use <_impl/_vrn2_space_cells_impl.scad>; +use <_impl/_convex_intersection_for.scad>; +use <../shape_square.scad>; -function voronoi_square_cells(size, grid_w, seed) = +function vrn2_space_cells(size, grid_w, seed) = let( sd = is_undef(seed) ? rands(0, 255, 1)[0] : seed, region_size = grid_w * 3, @@ -35,5 +35,5 @@ function voronoi_square_cells(size, grid_w, seed) = ) [ for(regions = regions_lt) - [regions[0], convex_intersection_for(regions[1])] + [regions[0], _convex_intersection_for(regions[1])] ]; \ No newline at end of file diff --git a/src/voronoi/vrn3_from.scad b/src/voronoi/vrn3_from.scad new file mode 100644 index 00000000..6df1be6e --- /dev/null +++ b/src/voronoi/vrn3_from.scad @@ -0,0 +1,43 @@ +/** +* vrn3_from.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vrn3_from.html +* +**/ + +use <__comm__/__angy_angz.scad>; + +// slow but workable + +module vrn3_from(points, spacing = 1) { + xs = [for(p = points) p[0]]; + ys = [for(p = points) abs(p[1])]; + zs = [for(p = points) abs(p[2])]; + + space_size = max([max(xs) - min(xs), max(ys) - min(ys), max(zs) - min(zs)]); + half_space_size = 0.5 * space_size; + double_space_size = 2 * space_size; + offset_leng = (spacing + space_size) * 0.5; + + function normalize(v) = v / norm(v); + + module space(pt) { + intersection_for(p = points) { + if(pt != p) { + v = p - pt; + ryz = __angy_angz(p, pt); + + translate((pt + p) / 2 - normalize(v) * offset_leng) + rotate([0, -ryz[0], ryz[1]]) + cube([space_size, double_space_size, double_space_size], center = true); + } + } + } + + for(p = points) { + space(p); + } +} \ No newline at end of file diff --git a/src/experimental/voronoi_cube.scad b/src/voronoi/vrn3_space.scad similarity index 98% rename from src/experimental/voronoi_cube.scad rename to src/voronoi/vrn3_space.scad index 15adce7a..d8b616b0 100644 --- a/src/experimental/voronoi_cube.scad +++ b/src/voronoi/vrn3_space.scad @@ -1,7 +1,7 @@ use <__comm__/__angy_angz.scad>; // slow but workable -module voronoi_cube(size, grid_w, seed, spacing = 1) { +module vrn3_space(size, grid_w, seed, spacing = 1) { _noise_table = [0.592157, 0.627451, 0.537255, 0.356863, 0.352941, 0.0588235, 0.513725, 0.0509804, 0.788235, 0.372549, 0.376471, 0.207843, 0.760784, 0.913725, 0.027451, 0.882353, 0.54902, 0.141176, 0.403922, 0.117647, 0.270588, 0.556863, 0.0313725, 0.388235, 0.145098, 0.941176, 0.0823529, 0.0392157, 0.0901961, 0.745098, 0.0235294, 0.580392, 0.968627, 0.470588, 0.917647, 0.294118, 0, 0.101961, 0.772549, 0.243137, 0.368627, 0.988235, 0.858824, 0.796078, 0.458824, 0.137255, 0.0431373, 0.12549, 0.223529, 0.694118, 0.129412, 0.345098, 0.929412, 0.584314, 0.219608, 0.341176, 0.682353, 0.0784314, 0.490196, 0.533333, 0.670588, 0.658824, 0.266667, 0.686275, 0.290196, 0.647059, 0.278431, 0.52549, 0.545098, 0.188235, 0.105882, 0.65098, 0.301961, 0.572549, 0.619608, 0.905882, 0.32549, 0.435294, 0.898039, 0.478431, 0.235294, 0.827451, 0.521569, 0.901961, 0.862745, 0.411765, 0.360784, 0.160784, 0.215686, 0.180392, 0.960784, 0.156863, 0.956863, 0.4, 0.560784, 0.211765, 0.254902, 0.0980392, 0.247059, 0.631373, 0.00392157, 0.847059, 0.313725, 0.286275, 0.819608, 0.298039, 0.517647, 0.733333, 0.815686, 0.34902, 0.0705882, 0.662745, 0.784314, 0.768627, 0.529412, 0.509804, 0.454902, 0.737255, 0.623529, 0.337255, 0.643137, 0.392157, 0.427451, 0.776471, 0.678431, 0.729412, 0.0117647, 0.25098, 0.203922, 0.85098, 0.886275, 0.980392, 0.486275, 0.482353, 0.0196078, 0.792157, 0.14902, 0.576471, 0.462745, 0.494118, 1, 0.321569, 0.333333, 0.831373, 0.811765, 0.807843, 0.231373, 0.890196, 0.184314, 0.0627451, 0.227451, 0.0666667, 0.713725, 0.741176, 0.109804, 0.164706, 0.87451, 0.717647, 0.666667, 0.835294, 0.466667, 0.972549, 0.596078, 0.00784314, 0.172549, 0.603922, 0.639216, 0.27451, 0.866667, 0.6, 0.396078, 0.607843, 0.654902, 0.168627, 0.67451, 0.0352941, 0.505882, 0.0862745, 0.152941, 0.992157, 0.0745098, 0.384314, 0.423529, 0.431373, 0.309804, 0.443137, 0.878431, 0.909804, 0.698039, 0.72549, 0.439216, 0.407843, 0.854902, 0.964706, 0.380392, 0.894118, 0.984314, 0.133333, 0.94902, 0.756863, 0.933333, 0.823529, 0.564706, 0.0470588, 0.74902, 0.701961, 0.635294, 0.945098, 0.317647, 0.2, 0.568627, 0.921569, 0.976471, 0.054902, 0.937255, 0.419608, 0.192157, 0.752941, 0.839216, 0.121569, 0.709804, 0.780392, 0.415686, 0.615686, 0.721569, 0.329412, 0.8, 0.690196, 0.45098, 0.47451, 0.196078, 0.176471, 0.498039, 0.0156863, 0.588235, 0.996078, 0.541176, 0.92549, 0.803922, 0.364706, 0.870588, 0.447059, 0.262745, 0.113725, 0.0941176, 0.282353, 0.952941, 0.552941, 0.501961, 0.764706, 0.305882, 0.258824, 0.843137, 0.239216, 0.611765, 0.705882]; function _lookup_noise_table(i) = _noise_table[i % 256];