]> git.lizzy.rs Git - worldedit.git/commitdiff
Fix one-node high cylinders
authorsfan5 <sfan5@live.de>
Sun, 3 Sep 2017 18:11:31 +0000 (20:11 +0200)
committersfan5 <sfan5@live.de>
Sun, 3 Sep 2017 18:12:38 +0000 (20:12 +0200)
closes #146

worldedit/primitives.lua

index 1b1b6853039fb073de0592e9641c8f42738c5bef..1bebfde31592920609887cd14ca05e2afdfa4ae5 100644 (file)
@@ -171,7 +171,7 @@ function worldedit.cylinder(pos, axis, length, radius1, radius2, node_name, holl
        local count = 0\r
        for i = 0, length - 1 do\r
                -- Calulate radius for this "height" in the cylinder\r
-               local radius = radius1 + (radius2 - radius1) * i / (length - 1)\r
+               local radius = radius1 + (radius2 - radius1) * (i + 1) / length\r
                radius = math.floor(radius + 0.5) -- round\r
                local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1)\r
 \r