From b8ec3e3f474460b323b982e96800cbee237c7d09 Mon Sep 17 00:00:00 2001 From: grilledham Date: Thu, 29 Mar 2018 19:23:58 +0100 Subject: [PATCH] add sine fill builder --- map_gen/shared/builders.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/map_gen/shared/builders.lua b/map_gen/shared/builders.lua index cfd755ad..6d404f68 100644 --- a/map_gen/shared/builders.lua +++ b/map_gen/shared/builders.lua @@ -88,6 +88,20 @@ function oval_builder(x_radius, y_radius) end end +function sine_fill_builder(width, height) + width_inv = tau / width + height_inv = -2 / height + return function(x, y) + local x2 = x * width_inv + local y2 = y * height_inv + if y <= 0 then + return y2 < math.sin(x2) + else + return y2 > math.sin(x2) + end + end +end + local tile_map = { [1] = false, [2] = true,