From be7b24417234acbab32c13915e411adfaaa181ff Mon Sep 17 00:00:00 2001 From: elexis Date: Fri, 9 Mar 2018 09:39:53 +0000 Subject: [PATCH] Refactor distributePointsOnCircle into distributePointsOnCircularSegment, refs #5061. git-svn-id: https://svn.wildfiregames.com/public/ps/trunk@21472 3db68df2-c116-0410-a063-a993310a9797 --- binaries/data/mods/public/maps/random/rmgen/math.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/maps/random/rmgen/math.js b/binaries/data/mods/public/maps/random/rmgen/math.js index b1a0e9e2ae..9777922925 100644 --- a/binaries/data/mods/public/maps/random/rmgen/math.js +++ b/binaries/data/mods/public/maps/random/rmgen/math.js @@ -36,12 +36,17 @@ function getAngle(x1, z1, x2, z2) */ function distributePointsOnCircle(pointCount, startAngle, radius, center) { + return distributePointsOnCircularSegment(pointCount, Math. PI * 2, startAngle, radius, center); +} + +function distributePointsOnCircularSegment(pointCount, maxAngle, startAngle, radius, center) +{ let points = []; let angle = []; for (let i = 0; i < pointCount; ++i) { - angle[i] = startAngle + 2 * Math.PI * i / pointCount; + angle[i] = startAngle + maxAngle * i / pointCount; points[i] = Vector2D.add(center, new Vector2D(radius, 0).rotate(-angle[i])); } -- 2.11.4.GIT