{"id":326700,"date":"2021-07-20T09:00:28","date_gmt":"2021-07-20T09:00:28","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=326700"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=326700","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043a\u0430\u0440\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"http:\/\/www-cs-students.stanford.edu\/~amitp\/game-programming\/polygon-map-generation\/\" rel=\"nofollow noopener noreferrer\">\u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0440\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e<\/a>, \u043d\u043e \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0451 \u043a\u043e\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u0440\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 Javascript:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ci\/ub\/ff\/ciubffgtwsazprlxr2cweofwxwa.png\"><\/div>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u043b\u044e\u0434\u0438 \u0445\u043e\u0442\u044f\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0448\u0443\u043c \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u0438 \u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0441-\u0448\u0443\u043c. \u042f \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438. \u0412\u043e\u0442 \u0447\u0435\u043c \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<ol>\n<li>\u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0441-\u0448\u0443\u043c: <a href=\"https:\/\/github.com\/jwagner\/simplex-noise.js\" rel=\"nofollow noopener noreferrer\">jwagner\/simplex-noise<\/a>.<\/li>\n<li>\u0412\u043e\u0440\u043e\u043d\u043e\u0439: <a href=\"https:\/\/github.com\/mapbox\/delaunator\" rel=\"nofollow noopener noreferrer\">mapbox\/delaunator<\/a>.<\/li>\n<\/ol>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 Javascript, \u0442\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u044f\u0437\u044b\u043a\u043e\u0432 \u0442\u043e\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0448\u0443\u043c\u0430, \u0430 Delaunator \u0431\u044b\u043b \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u044f\u0437\u044b\u043a\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>npm<\/code> \u0438\u043b\u0438 <code>yarn<\/code>, \u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0431\u0443\u0434\u0443 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0445 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0442\u0435\u0433\u043e\u0432 <code>script<\/code>. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Delaunator \u0435\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u044d\u0442\u043e\u043c, \u043d\u043e \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0441-\u0448\u0443\u043c\u0430 \u0435\u0451 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0434\u043b\u044f \u0438\u0445 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 <a href=\"https:\/\/unpkg.com\/\" rel=\"nofollow noopener noreferrer\">unpkg<\/a>:<\/p>\n<pre><code class=\"javascript\">&lt;script src=&quot;https:\/\/unpkg.com\/simplex-noise@2.4.0\/simplex-noise.js&quot;&gt;&lt;\/script&gt; &lt;script src=&quot;https:\/\/unpkg.com\/delaunator@4.0.1\/delaunator.min.js&quot;&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>  \u042f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u0441\u0432\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b \u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u043b \u0435\u0433\u043e \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">&lt;canvas id=&quot;map&quot; width=&quot;1000&quot; height=&quot;1000&quot;&gt;&lt;\/canvas&gt; &lt;script src=&quot;voronoi-maps-tutorial.js&quot;&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>  <\/p>\n<h2>1. \u041f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0435 \u0442\u043e\u0447\u043a\u0438<\/h2>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0440\u0442\u044b \u0441 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u044b\u043c\u0438 \u0442\u0430\u0439\u043b\u0430\u043c\u0438 \u043c\u044b \u0431\u044b \u043e\u0431\u043e\u0448\u043b\u0438 \u0435\u0451 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0431\u044b \u0442\u0430\u0439\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438:<\/p>\n<pre><code class=\"javascript\">const GRIDSIZE = 25; let points = []; for (let x = 0; x &lt;= GRIDSIZE; x++) {     for (let y = 0; y &lt;= GRIDSIZE; y++) {         points.push({x, y});     } }<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u043e\u0432. \u0425\u043e\u0442\u044f \u0434\u043b\u044f \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435 \u0436\u0435 \u0442\u043e\u0447\u043a\u0438, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043b\u0438\u043d\u0438\u0439 \u0441\u0435\u0442\u043a\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c <em>\u0444\u043b\u0443\u043a\u0442\u0443\u0430\u0446\u0438\u0438<\/em>:<\/p>\n<pre><code class=\"javascript\">const GRIDSIZE = 25; const JITTER = 0.5; let points = []; for (let x = 0; x &lt;= GRIDSIZE; x++) {     for (let y = 0; y &lt;= GRIDSIZE; y++) {         points.push({x: x + JITTER * (Math.random() - Math.random()),                      y: y + JITTER * (Math.random() - Math.random())});     } }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0438 \u044d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u043c:<\/p>\n<pre><code class=\"javascript\">function drawPoints(canvas, points) {     let ctx = canvas.getContext('2d');     ctx.save();     ctx.scale(canvas.width \/ GRIDSIZE, canvas.height \/ GRIDSIZE);     ctx.fillStyle = &quot;hsl(0, 50%, 50%)&quot;;     for (let {x, y} of points) {         ctx.beginPath();         ctx.arc(x, y, 0.1, 0, 2*Math.PI);         ctx.fill();     }     ctx.restore(); }  drawPoints(document.getElementById(&quot;diagram-points&quot;), points);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/eb\/2r\/er\/eb2rerpm8e16e1kwpifly8cpjjk.png\"><\/div>\n<p>  <i>\u0422\u043e\u0447\u043a\u0438 \u0441 \u0444\u043b\u0443\u043a\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438<\/i><\/p>\n<p>  \u042d\u0442\u0438 \u0442\u043e\u0447\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u043f\u043e\u043a\u0430 \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e.<\/p>\n<h2>2. \u042f\u0447\u0435\u0439\u043a\u0438 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e<\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u0445 \u0442\u043e\u0447\u0435\u043a. \u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Delaunator \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f <em>\u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u0414\u0435\u043b\u043e\u043d\u0435<\/em> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0442\u0430\u043a, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/mapbox.github.io\/delaunator\/\" rel=\"nofollow noopener noreferrer\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e Delaunator<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u044f\u0447\u0435\u0435\u043a \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e (\u0431\u0435\u0437 \u0443\u0441\u0435\u0447\u0435\u043d\u0438\u044f).<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u044d\u0442\u0430\u043f\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0442\u0440\u0438\u0430\u043d\u0433\u0443\u043b\u044f\u0446\u0438\u0438 \u0414\u0435\u043b\u043e\u043d\u0435:<\/p>\n<pre><code class=\"javascript\">let delaunay = Delaunator.from(points, loc =&gt; loc.x, loc =&gt; loc.y);<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0446\u0435\u043d\u0442\u0440\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432. \u041f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044e \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0443\u044e <em>\u0446\u0435\u043d\u0442\u0440\u044b \u0442\u044f\u0436\u0435\u0441\u0442\u0438<\/em>. \u041a\u043e\u0434 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0435\u0439, \u0438 \u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438 \u0442\u044f\u0436\u0435\u0441\u0442\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"javascript\">function calculateCentroids(points, delaunay) {     const numTriangles = delaunay.halfedges.length \/ 3;     let centroids = [];     for (let t = 0; t &lt; numTriangles; t++) {         let sumOfX = 0, sumOfY = 0;         for (let i = 0; i &lt; 3; i++) {             let s = 3*t + i;             let p = points[delaunay.triangles[s]];             sumOfX += p.x;             sumOfY += p.y;         }         centroids[t] = {x: sumOfX \/ 3, y: sumOfY \/ 3};     }     return centroids; }<\/code><\/pre>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u0447\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0451 \u0432 \u043d\u0451\u043c:<\/p>\n<pre><code class=\"javascript\">let map = {     points,     numRegions: points.length,     numTriangles: delaunay.halfedges.length \/ 3,     numEdges: delaunay.halfedges.length,     halfedges: delaunay.halfedges,     triangles: delaunay.triangles,     centers: calculateCentroids(points, delaunay) };<\/code><\/pre>\n<p>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u044f\u0447\u0435\u0439\u043a\u0438 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043a\u043e\u0434\u0435 \u0438\u0437 <a href=\"https:\/\/mapbox.github.io\/delaunator\/\" rel=\"nofollow noopener noreferrer\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e Delaunator<\/a><\/p>\n<pre><code class=\"javascript\">function triangleOfEdge(e)  { return Math.floor(e \/ 3); } function nextHalfedge(e) { return (e % 3 === 2) ? e - 2 : e + 1; }  function drawCellBoundaries(canvas, map) {     let {points, centers, halfedges, triangles, numEdges} = map;     let ctx = canvas.getContext('2d');     ctx.save();     ctx.scale(canvas.width \/ GRIDSIZE, canvas.height \/ GRIDSIZE);     ctx.lineWidth = 0.02;     ctx.strokeStyle = &quot;black&quot;;     for (let e = 0; e &lt; numEdges; e++) {         if (e &lt; delaunay.halfedges[e]) {             const p = centers[triangleOfEdge(e)];             const q = centers[triangleOfEdge(halfedges[e])];             ctx.beginPath();             ctx.moveTo(p.x, p.y);             ctx.lineTo(q.x, q.y);             ctx.stroke();         }     }     ctx.restore(); } drawCellBoundaries(document.getElementById(&quot;diagram-boundaries&quot;), map);<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5e\/jb\/wa\/5ejbwatdeketjowpegc75btkm3a.png\"><\/div>\n<p>  <i>\u0413\u0440\u0430\u043d\u0438\u0446\u044b \u044f\u0447\u0435\u0435\u043a<\/i><\/p>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u0440\u0430\u0451\u0432 \u043a\u0430\u0440\u0442\u044b, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043a\u0430 \u043e \u043d\u0438\u0445 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0438 \u043d\u0430\u0439\u0434\u0451\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h2>3. \u0424\u043e\u0440\u043c\u0430 \u043e\u0441\u0442\u0440\u043e\u0432\u0430<\/h2>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u0430\u0440\u0442\u044b \u0432\u044b\u0441\u043e\u0442. \u042f \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u044e \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 <a href=\"https:\/\/www.redblobgames.com\/maps\/terrain-from-noise\/#islands\" rel=\"nofollow noopener noreferrer\">\u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0440\u0435\u043b\u044c\u0435\u0444\u0430 \u0438\u0437 \u0448\u0443\u043c\u0430<\/a> [<a href=\"https:\/\/habr.com\/ru\/post\/322504\/\">\u043f\u0435\u0440\u0435\u0432\u043e\u0434<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435]. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u043d\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0442\u0430\u0439\u043b\u0443, \u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0438\u0445 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e \u043d\u043e\u043c\u0435\u0440\u0443 \u044f\u0447\u0435\u0439\u043a\u0438.<\/p>\n<pre><code class=\"javascript\">const WAVELENGTH = 0.5; function assignElevation(map) {     const noise = new SimplexNoise();     let {points, numRegions} = map;     let elevation = [];     for (let r = 0; r &lt; numRegions; r++) {         let nx = points[r].x \/ GRIDSIZE - 1\/2,             ny = points[r].y \/ GRIDSIZE - 1\/2;         \/\/ start with noise:         elevation[r] = (1 + noise.noise2D(nx \/ WAVELENGTH, ny \/ WAVELENGTH)) \/ 2;         \/\/ modify noise to make islands:         let d = 2 * Math.max(Math.abs(nx), Math.abs(ny)); \/\/ should be 0-1         elevation[r] = (1 + elevation[r] - d) \/ 2;     }     return elevation; }  map.elevation = assignElevation(map);<\/code><\/pre>\n<p>  \u041e\u0442\u0440\u0438\u0441\u0443\u0435\u043c \u044d\u0442\u0438 \u044f\u0447\u0435\u0439\u043a\u0438. \u042f \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u043a\u043e\u0434\u043e\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/mapbox.github.io\/delaunator\/\" rel=\"nofollow noopener noreferrer\">\u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e Delaunator<\/a>.<\/p>\n<pre><code class=\"javascript\">function edgesAroundPoint(delaunay, start) {     const result = [];     let incoming = start;     do {         result.push(incoming);         const outgoing = nextHalfedge(incoming);         incoming = delaunay.halfedges[outgoing];     } while (incoming !== -1 &amp;&amp; incoming !== start);     return result; }  function drawCellColors(canvas, map, colorFn) {     let ctx = canvas.getContext('2d');     ctx.save();     ctx.scale(canvas.width \/ GRIDSIZE, canvas.height \/ GRIDSIZE);     let seen = new Set();  \/\/ of region ids     let {triangles, numEdges, centers} = map;     for (let e = 0; e &lt; numEdges; e++) {         const r = triangles[nextHalfedge(e)];         if (!seen.has(r)) {             seen.add(r);             let vertices = edgesAroundPoint(delaunay, e)                 .map(e =&gt; centers[triangleOfEdge(e)]);             ctx.fillStyle = colorFn(r);             ctx.beginPath();             ctx.moveTo(vertices[0].x, vertices[0].y);             for (let i = 1; i &lt; vertices.length; i++) {                 ctx.lineTo(vertices[i].x, vertices[i].y);             }             ctx.fill();         }     } }  drawCellColors(     document.getElementById(&quot;diagram-cell-elevations&quot;),     map,     r =&gt; map.elevation[r] &lt; 0.5? &quot;hsl(240, 30%, 50%)&quot; : &quot;hsl(90, 20%, 50%)&quot; );<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cp\/1g\/70\/cp1g70istnft0c_tqwbdrkpobmw.png\"><\/div>\n<p>  <i>\u0412\u044b\u0441\u043e\u0442\u044b \u044f\u0447\u0435\u0435\u043a<\/i><\/p>\n<p>  \u041f\u0443\u0441\u0442\u044c \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u0437\u0430\u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043d\u043e \u043e\u0441\u043d\u043e\u0432\u0430 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c.<\/p>\n<h2>4. \u0411\u0438\u043e\u043c\u044b<\/h2>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0431\u0438\u043e\u043c\u044b. \u042f \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430\u043c\u0438 \u0438\u0437 <a href=\"https:\/\/www.redblobgames.com\/maps\/terrain-from-noise\/#biomes\" rel=\"nofollow noopener noreferrer\">\u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0440\u0435\u043b\u044c\u0435\u0444\u0430 \u0438\u0437 \u0448\u0443\u043c\u0430<\/a> [<a href=\"https:\/\/habr.com\/ru\/post\/322504\/\">\u043f\u0435\u0440\u0435\u0432\u043e\u0434<\/a> \u043d\u0430 \u0425\u0430\u0431\u0440\u0435]. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 <em>\u0432\u0442\u043e\u0440\u043e\u0439<\/em> \u043a\u0430\u0440\u0442\u044b \u0448\u0443\u043c\u0430:<\/p>\n<pre><code class=\"javascript\">function assignMoisture(map) {     const noise = new SimplexNoise();     let {points, numRegions} = map;     let moisture = [];     for (let r = 0; r &lt; numRegions; r++) {         let nx = points[r].x \/ GRIDSIZE - 1\/2,             ny = points[r].y \/ GRIDSIZE - 1\/2;         moisture[r] = (1 + noise.noise2D(nx \/ WAVELENGTH, ny \/ WAVELENGTH)) \/ 2;     }     return moisture; }  map.moisture = assignMoisture(map);<\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u0432\u044b\u0441\u043e\u0442 \u0438 \u043a\u0430\u0440\u0442\u0443 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u0446\u0432\u0435\u0442\u0430 \u0431\u0438\u043e\u043c\u0430:<\/p>\n<pre><code class=\"javascript\">function biomeColor(map, r) {     let e = (map.elevation[r] - 0.5) * 2,         m = map.moisture[r];     if (e &lt; 0.0) {         r = 48 + 48*e;         g = 64 + 64*e;         b = 127 + 127*e;     } else {         m = m * (1-e); e = e**4; \/\/ tweaks         r = 210 - 100 * m;         g = 185 - 45 * m;         b = 139 - 45 * m;         r = 255 * e + r * (1-e),         g = 255 * e + g * (1-e),         b = 255 * e + b * (1-e);     }     return `rgb(${r|0}, ${g|0}, ${b|0})`; }  drawCellColors(     document.getElementById(&quot;diagram-cell-biomes&quot;),     map,     r =&gt; biomeColor(map, r) );<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/iz\/hu\/e5\/izhue5n4eijc8ufrvonovakxqhg.png\"><\/div>\n<p>  <i>\u0411\u0438\u043e\u043c\u044b<\/i><\/p>\n<p>  \u041e, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u043e!<\/p>\n<h2>5. \u0414\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u0448\u0430\u0433\u0438<\/h2>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0441 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0440\u0442\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u044f\u043c\u044b\u0435 \u043a\u0440\u0430\u044f, \u0430 \u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u043a\u0440\u0430\u044f \u043d\u0435\u0440\u043e\u0432\u043d\u044b\u0435. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a: \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u043e\u0432\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u0432\u043d\u0435 \u043a\u0430\u0440\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u043a\u0430\u0440\u0442\u044b \u0438\u043c\u0435\u043b\u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u0442\u043e\u0447\u043a\u0443 \u0437\u0430 \u043a\u0440\u0430\u044f\u043c\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f.<\/p>\n<pre><code class=\"javascript\">points.push({x: -10, y: GRIDSIZE\/2}); points.push({x: GRIDSIZE+10, y: GRIDSIZE\/2}); points.push({y: -10, x: GRIDSIZE\/2}); points.push({y: GRIDSIZE+10, x: GRIDSIZE\/2}); points.push({x: -10, y: -10}); points.push({x: GRIDSIZE+10, y: GRIDSIZE+10}); points.push({y: -10, x: GRIDSIZE+10}); points.push({y: GRIDSIZE+10, x: -10});<\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0442\u044c \u043a\u043e\u0434 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u0432\u0430\u0448 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<\/li>\n<li>\u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c <a href=\"https:\/\/www.redblobgames.com\/x\/1830-jittered-grid\/\" rel=\"nofollow noopener noreferrer\">\u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a<\/a> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u043b\u0443\u043a\u0442\u0443\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u00ab\u0441\u0438\u043d\u0435\u0433\u043e \u0448\u0443\u043c\u0430\u00bb \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"https:\/\/www.npmjs.com\/package\/poisson-disk-sampling\" rel=\"nofollow noopener noreferrer\">poisson-disk-sampling<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/observablehq.com\/@techsparx\/an-improvement-on-bridsons-algorithm-for-poisson-disc-samp\/2\" rel=\"nofollow noopener noreferrer\">\u044d\u0442\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/a> \u041c\u0430\u0440\u0442\u0438\u043d\u0430 \u0420\u043e\u0431\u0435\u0440\u0442\u0441\u0430<\/li>\n<li>\u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u043f\u043e \u043a\u0440\u0430\u044f\u043c \u043a\u0430\u0440\u0442\u044b \u0438\u043b\u0438 \u0443\u0441\u0435\u043a\u0430\u0442\u044c \u0438\u0445<\/li>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u043f\u043e\u043b\u0443\u0447\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u043e\u0441\u0442\u0440\u043e\u0432\u0430<\/li>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u043a\u0442\u0430\u0432 \u0434\u043b\u044f \u0448\u0443\u043c\u0430 \u0432\u044b\u0441\u043e\u0442 \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438; \u0441\u043c. <a href=\"https:\/\/www.redblobgames.com\/maps\/terrain-from-noise\/\" rel=\"nofollow noopener noreferrer\">\u043c\u043e\u0451 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0448\u0443\u043c\u0443 \u0434\u043b\u044f \u043a\u0430\u0440\u0442<\/a><\/li>\n<\/ul>\n<p>  \u042f \u043e\u043f\u0438\u0441\u0430\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 <a href=\"http:\/\/www-cs-students.stanford.edu\/~amitp\/game-programming\/polygon-map-generation\/\" rel=\"nofollow noopener noreferrer\">\u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0440\u0442<\/a>.<\/p>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/www.redblobgames.com\/maps\/terrain-from-noise\/\" rel=\"nofollow noopener noreferrer\">voronoi-maps-tutorial.js<\/a>. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b org-mode \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 emacs, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043a\u043e\u0434 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0444\u0430\u0439\u043b javascript, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b \u0444\u0430\u0439\u043b javascript \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c. \u041a\u043e\u0434, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u0435\u043d \u0441 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/567646\/\"> https:\/\/habr.com\/ru\/post\/567646\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"http:\/\/www-cs-students.stanford.edu\/~amitp\/game-programming\/polygon-map-generation\/\" rel=\"nofollow noopener noreferrer\">\u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0438\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0440\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e<\/a>, \u043d\u043e \u043d\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0451 \u043a\u043e\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u0430\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u0440\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 Javascript:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ci\/ub\/ff\/ciubffgtwsazprlxr2cweofwxwa.png\"><\/div>\n<p>  \u041c\u043d\u043e\u0433\u0438\u0435 \u043b\u044e\u0434\u0438 \u0445\u043e\u0442\u044f\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0448\u0443\u043c \u0412\u043e\u0440\u043e\u043d\u043e\u0433\u043e \u0438 \u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0441-\u0448\u0443\u043c. \u042f \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438. \u0412\u043e\u0442 \u0447\u0435\u043c \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f:<\/p>\n<ol>\n<li>\u0441\u0438\u043c\u043f\u043b\u0435\u043a\u0441-\u0448\u0443\u043c: <a href=\"https:\/\/github.com\/jwagner\/simplex-noise.js\" rel=\"nofollow noopener noreferrer\">jwagner\/simplex-noise<\/a>.<\/li>\n<li>\u0412\u043e\u0440\u043e\u043d\u043e\u0439: <a href=\"https:\/\/github.com\/mapbox\/delaunator\" rel=\"nofollow noopener noreferrer\">mapbox\/delaunator<\/a>.<\/li>\n<\/ol>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 Javascript, \u0442\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u044f\u0437\u044b\u043a\u043e\u0432 \u0442\u043e\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0448\u0443\u043c\u0430, \u0430 Delaunator \u0431\u044b\u043b \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u043c\u043d\u043e\u0433\u0438\u0435 \u044f\u0437\u044b\u043a\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-326700","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=326700"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/326700\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}